IfcSharp / IfcSharpLibrary

Other
64 stars 17 forks source link

simple new IFC with extruded rectangle #18

Open kbworkza opened 2 weeks ago

kbworkza commented 2 weeks ago

Greetings, Is there s forum I could post this to? I just want to include am extruded rectangle in the IFC file (in the Project). This fails at SHAPEREPRESENTATION - exception value cannot be null it probably needs a few more objects to complete the inclusion of the extrusion in the Project.

` ifc.Repository.CurrentModel = new ifc.Model(Name: "hello_project_output"); ifc.Project project = new ifc.Project(); project.Name = new ifc.Label("my first ifc-project"); project.EndOfLineComment = new ifc.Label("creating the project");

        ifc.Building building = new ifc.Building(GlobalId: null, Name: new ifc.Label("my first ifc-model"));

        new ifc.RelAggregates(RelatingObject: project, RelatedObjects: new ifc.Set1toUnbounded_ObjectDefinition(building));

        var MRect = new ifc.RectangleProfileDef() {
            ProfileType = ifc.ProfileTypeEnum.AREA,
            XDim = 5.0,
            YDim = 5.0
        };

        var MREx = new ifc.ExtrudedAreaSolid() {
            SweptArea = MRect,
            ExtrudedDirection = new ifc.Direction(0, 0, 1),
            Depth = 5.0
        };

        var SRep = new ifc.ShapeRepresentation() { 
            ContextOfItems = project.RepresentationContexts.FirstOrDefault(),
            RepresentationType = "SweptSold",
            RepresentationIdentifier = "Body",
            Items = new ifc.Set1toUnbounded_RepresentationItem(MREx)
        };

        ifc.Repository.CurrentModel.ToStepFile();

`