GeometryGymIFC

repository·main·Indexed 43 days ago

https://github.com/geometrygym/geometrygymifc

A C# library for generating and parsing OpenBIM IFC files. It supports multiple versions, including IFC2x3, IFC4, and infrastructure extensions IFC4.3 and IFC4.4. The library provides the DatabaseIfc class for managing IFC databases and exporting models to STEP-P21 format.

Tokens
971
Snippets
5
Records
8
Agent score
5%

What's inside GeometryGymIFC

  1. Overview of GeometryGymIFC

    main

    GeometryGymIFC provides C# classes designed for generating and parsing OpenBIM IFC (Industry Foundation Class) files. The library is designed to be multi-version compatible, supporting:

    • IFC2x3
    • IFC4
    • Infrastructure extensions (such as IFC4.3 and IFC4.4)

    The library provides early support for new IFC versions and extension projects. For detailed technical specifications of the underlying data models, refer to the official BuildingSmart documentation.

  2. General conventions for IFC class constructors

    main

    When working with IFC classes, follow these conventions to ensure schema compliance:

    • Required Attributes: Constructors for IFC classes typically require all non-optional attributes.
    • Avoid Nulls: Passing null into a constructor is generally not intended and will likely result in non-schema-compliant IFC files.
  3. Install GeometryGymIFC via NuGet

    main

    GeometryGymIFC is available via the NuGet package manager. You can install it using the NuGet Package Manager GUI or via the Package Manager Console.

    To use the library in your C# code, add the following directive:

    using GeometryGym.Ifc;
    # Install the latest version
    Install-Package GeometryGymIFC
    
    # Install a specific version
    Install-Package GeometryGymIFC -Version 0.1.6
  4. Create a new Ifc model

    main

    You can initialize a new IFC database using the DatabaseIfc constructor. You must specify a ModelView (e.g., ModelView.Ifc4X3_RC2).

    By default, calling the constructor with only a ModelView generates boilerplate data. If you want to explicitly control whether boilerplate data is generated, use the boolean overload.

    // Create a new database with default boilerplate
    var database = new DatabaseIfc(ModelView.Ifc4X3_RC2);
    
    // Explicitly trigger boilerplate generation
    var database = new DatabaseIfc(true, ModelView.Ifc4X3_RC2);
    var database = new DatabaseIfc(ModelView.Ifc4X3_RC2);
  5. Configure the DatabaseIfc factory

    main

    Once a DatabaseIfc instance is created, you can use its Factory property to configure metadata and generation options for the model.

    Common configuration tasks include:

    • Setting the Application Developer name.
    • Setting the Application Full Name.
    • Controlling the auto-generation of IfcOwnerHistory via database.Factory.Options.

    To add textual comments directly into the resulting .ifc file, use the AddComment method on specific IFC elements.

    // Set application metadata
    database.Factory.ApplicationDeveloper = "Developer Name";
    database.Factory.ApplicationFullName = "IFC Application";
    
    // Disable auto-generation of IfcOwnerHistory
    database.Factory.Options.GenerateOwnerHistory = false;
    
    // Add a comment to a specific element
    var element = new IfcBuiltElement(database);
    element.AddComment("some comment");