Skip to content

Not able to write IFC4x3 elements #18

@cesarecaoduro

Description

@cesarecaoduro

I thought I would open an issue here to seek for help.
I am trying to programmatically build a bridge with all the parts, and write to a proper IFC4x3. It seems I am missing something to add the object to the db with the results that I can't see anything if I try to import the IFC back into Rhino.

I have succeeded in doing it using GH, but I can't match the same process in C#. --> Link to repo

using GeometryGym.Ifc;

var db = new DatabaseIfc(ReleaseVersion.IFC4X3_RC4);
var site = new IfcSite(db, "MySite")
{
    Description = "Just another site",
};


var facility = new IfcFacility(db, "MyFacility");

var bridge = new IfcBridge(db)
{
    Name = "MyBridge",
    Description = "Just another bridge"
};

var project = new IfcProject(site, "MyProject", IfcUnitAssignment.Length.Metre);
{
};


var foundations = new IfcFacilityPart(
    bridge,
    "Foundations",
    new IfcFacilityPartTypeSelect(IfcFacilityPartCommonTypeEnum.BELOWGROUND),
    IfcFacilityUsageEnum.NOTDEFINED
    );

var name = "Pile Cap";
var length = 1.2;
var width = 1.2;
var depth = 2.4;

IfcMaterial material = new IfcMaterial(db, "Concrete")
{
};

IfcFootingType footingType = new IfcFootingType(db, name, IfcFootingTypeEnum.PAD_FOOTING)
{
    MaterialSelect = material,
};

IfcRectangleHollowProfileDef rect = new IfcRectangleHollowProfileDef(db, name, length, width, depth);
IfcExtrudedAreaSolid extrusion = new IfcExtrudedAreaSolid(rect, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), new IfcDirection(db, 0, 0, 1), depth);

IfcProductDefinitionShape productRep = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrusion));
IfcShapeRepresentation shapeRep = new(extrusion);

footingType.RepresentationMaps.Add(
    new IfcRepresentationMap(
        db.Factory.XYPlanePlacement,
        shapeRep
    )
);

IfcFooting footing = new(
    foundations,
    null,
    productRep
    )
{
    PredefinedType = IfcFootingTypeEnum.PAD_FOOTING,
    ObjectType = name
};

db.WriteFile(Path.Combine("IFC4X3RC4_testBridge.ifc"));

Any help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions