protected override void GenerateData(DatabaseIfc db, IfcBuilding building) { List <Coord3d> points = new List <Coord3d>() { new Coord3d(0, 0, 0), new Coord3d(1000, 0, 0), new Coord3d(1000, 1000, 0), new Coord3d(0, 1000, 0), new Coord3d(0, 0, 2000), new Coord3d(1000, 0, 2000), new Coord3d(1000, 1000, 2000), new Coord3d(0, 1000, 2000) }; IfcCartesianPointList3D cartesianPointList3D = new IfcCartesianPointList3D(db, points); List <CoordIndex> coordIndex = new List <CoordIndex>() { new CoordIndex(1, 6, 5), new CoordIndex(1, 2, 6), new CoordIndex(6, 2, 7), new CoordIndex(7, 2, 3), new CoordIndex(7, 8, 6), new CoordIndex(6, 8, 5), new CoordIndex(5, 8, 1), new CoordIndex(1, 8, 4), new CoordIndex(4, 2, 1), new CoordIndex(2, 4, 3), new CoordIndex(4, 8, 7), new CoordIndex(7, 3, 4) }; IfcTriangulatedFaceSet triangulatedFaceSet = new IfcTriangulatedFaceSet(cartesianPointList3D, true, coordIndex); IfcColourRgbList colourRgbList = new IfcColourRgbList(db, new List <Color>() { Color.Red, Color.Green, Color.Yellow }); IfcIndexedColourMap indexedColourMap = new IfcIndexedColourMap(triangulatedFaceSet, colourRgbList, new List <int>() { 1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1 }); db.NextObjectRecord = 300; IfcBuildingElementProxy buildingElementProxy = new IfcBuildingElementProxy(building, null, new IfcProductDefinitionShape(new IfcShapeRepresentation(triangulatedFaceSet))); //Unique ids assigned to generate constant IfcScript sample files, remove otherwise buildingElementProxy.GlobalId = "25c34fWeL1NQux73WfnXox"; }
protected override void GenerateData(STPModelData md, IfcBuilding building) { List <Point3d> points = new List <Point3d>() { new Point3d(0, 0, 0), new Point3d(1000, 0, 0), new Point3d(1000, 1000, 0), new Point3d(0, 1000, 0), new Point3d(0, 0, 2000), new Point3d(1000, 0, 2000), new Point3d(1000, 1000, 2000), new Point3d(0, 1000, 2000) }; IfcCartesianPointList3D cartesianPointList3D = new IfcCartesianPointList3D(md, points); List <CoordIndex> coordIndex = new List <CoordIndex>() { new CoordIndex(1, 6, 5), new CoordIndex(1, 2, 6), new CoordIndex(6, 2, 7), new CoordIndex(7, 2, 3), new CoordIndex(7, 8, 6), new CoordIndex(6, 8, 5), new CoordIndex(5, 8, 1), new CoordIndex(1, 8, 4), new CoordIndex(4, 2, 1), new CoordIndex(2, 4, 3), new CoordIndex(4, 8, 7), new CoordIndex(7, 3, 4) }; IfcTriangulatedFaceSet triangulatedFaceSet = new IfcTriangulatedFaceSet(md, cartesianPointList3D, null, true, coordIndex, null); IfcColourRgbList colourRgbList = new IfcColourRgbList(md, new List <Color>() { Color.Red, Color.Green, Color.Yellow }); IfcIndexedColourMap indexedColourMap = new IfcIndexedColourMap(md, triangulatedFaceSet, colourRgbList, new List <int>() { 1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1 }); md.NextObjectRecord = 300; IfcBuildingElementProxy buildingElementProxy = new IfcBuildingElementProxy(building, triangulatedFaceSet) { GlobalId = "25c34fWeL1NQux73WfnXox" }; }
private static IfcBuildingElementProxy ToIfc(this Mass mass, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var proxy = new IfcBuildingElementProxy(IfcGuid.ToIfcGuid(id), null, null, null, null, localPlacement, shape, null, IfcBuildingElementProxyTypeEnum.ELEMENT); return(proxy); }
public IfcBuildingElementProxy AddBuildingElement(IfcBuildingStorey storey, string name = "", string description = "") { var e = new IfcBuildingElementProxy(IfcGuid.IfcGuid.ToIfcGuid(Guid.NewGuid())); e.Name = name; e.Description = description; storage.AddInstance(e); CreateAggregationRelationship(storey, e); return(e); }
/// <summary> /// Add the data to the IfcMaterialLayerSet object /// </summary> /// <param name="row">COBieAssemblyRow holding the data</param> private void AddMaterial(COBieAssemblyRow row) { //check we have a chance of creating the IfcMaterialLayerSet object if (ValidateString(row.ParentName)) // && (ValidateString(row.ChildNames)) { IfcMaterialLayerSet ifcMaterialLayerSet = null; IfcMaterialLayerSetUsage ifcMaterialLayerSetUsage = null; IfcRelAssociatesMaterial ifcRelAssociatesMaterial = null; IfcBuildingElementProxy ifcBuildingElementProxy = null; if ((LastIfcMaterialLayerSet != null) && IsContinuedMaterialRow(row)) //this row line is a continuation of objects from the line above { ifcMaterialLayerSet = LastIfcMaterialLayerSet; } else { ifcMaterialLayerSet = Model.FederatedInstances.Where <IfcMaterialLayerSet>(mls => mls.LayerSetName == row.ParentName).FirstOrDefault(); if (ifcMaterialLayerSet == null) { ifcMaterialLayerSet = Model.Instances.New <IfcMaterialLayerSet>(mls => { mls.LayerSetName = row.ParentName; }); } ifcMaterialLayerSetUsage = Model.FederatedInstances.Where <IfcMaterialLayerSetUsage>(mlsu => mlsu.ForLayerSet == ifcMaterialLayerSet).FirstOrDefault(); if (ifcMaterialLayerSetUsage == null) { ifcMaterialLayerSetUsage = Model.Instances.New <IfcMaterialLayerSetUsage>(mlsu => { mlsu.ForLayerSet = ifcMaterialLayerSet; }); } string placeholderText = "Place holder for material layer Set " + row.ParentName; ifcBuildingElementProxy = Model.FederatedInstances.Where <IfcBuildingElementProxy>(bep => bep.Name == placeholderText).FirstOrDefault(); if (ifcBuildingElementProxy == null) { ifcBuildingElementProxy = Model.Instances.New <IfcBuildingElementProxy>(bep => { bep.Name = placeholderText; }); } ifcRelAssociatesMaterial = Model.FederatedInstances.Where <IfcRelAssociatesMaterial>(ras => ((ras.RelatingMaterial as IfcMaterialLayerSetUsage) == ifcMaterialLayerSetUsage)).FirstOrDefault(); if (ifcRelAssociatesMaterial == null) { ifcRelAssociatesMaterial = Model.Instances.New <IfcRelAssociatesMaterial>(ras => { ras.RelatingMaterial = ifcMaterialLayerSetUsage; ras.RelatedObjects.Add(ifcBuildingElementProxy); }); //Add Created By, Created On and ExtSystem to Owner History. SetUserHistory(ifcRelAssociatesMaterial, row.ExtSystem, row.CreatedBy, row.CreatedOn); } } //add the child objects AddChildObjects(ifcMaterialLayerSet, row.ChildNames); LastIfcMaterialLayerSet = ifcMaterialLayerSet; } }
static void Main(string[] args) { var dbInitial = new DatabaseIfc(ModelView.Ifc4NotAssigned); dbInitial.Factory.Options.GenerateOwnerHistory = false; var site = new IfcSite(dbInitial, "site") { Guid = new Guid("aa4019f8-2584-44a1-a132-c17dfff69c41") }; var project = new IfcProject(dbInitial, "GeomRep") { Guid = new Guid("94d4ddac-9120-4fb9-bea0-7a414ee725d4") }; new IfcRelAggregates(project, new List <IfcObjectDefinition>() { site }) { Guid = new Guid("5e1fd0e5-b005-fe11-501e-5caff01dc1ad") }; IfcAxis2Placement3D placement1 = new IfcAxis2Placement3D(new IfcCartesianPoint(dbInitial, 2, 5, 1)); IfcLocalPlacement objectPlacement1 = new IfcLocalPlacement(site.ObjectPlacement, placement1); IfcAxis2Placement3D placement2 = new IfcAxis2Placement3D(new IfcCartesianPoint(dbInitial, 14, 5, 1)); IfcLocalPlacement objectPlacement2 = new IfcLocalPlacement(site.ObjectPlacement, placement2); var profile1 = new IfcRectangleProfileDef(dbInitial, "rectangleProfileDef", 4, 6); IfcExtrudedAreaSolid extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); IfcProductDefinitionShape shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); var profile2 = new IfcRectangleProfileDef(dbInitial, "rectangleProfileDef", 5, 8); IfcExtrudedAreaSolid extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 4.1); IfcProductDefinitionShape shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); var proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid1", Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bbaa") }; var proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2) { Name = "Cuboid2", Guid = new Guid("f8e196cb-c7d9-4d53-9885-0f687706727a") }; dbInitial.WriteFile("cube_double.ifc"); }
protected override void GenerateData(STPModelData md, IfcBuilding building) { List<Point3d> points = new List<Point3d>() { new Point3d(0, 0, 0), new Point3d(1000, 0, 0), new Point3d(1000, 1000, 0), new Point3d(0, 1000, 0), new Point3d(0, 0, 2000), new Point3d(1000, 0, 2000), new Point3d(1000, 1000, 2000), new Point3d(0, 1000, 2000) }; IfcCartesianPointList3D cartesianPointList3D = new IfcCartesianPointList3D(md, points); List<CoordIndex> coordIndex = new List<CoordIndex>() { new CoordIndex(1, 6, 5), new CoordIndex(1, 2, 6), new CoordIndex(6, 2, 7), new CoordIndex(7, 2, 3), new CoordIndex(7, 8, 6), new CoordIndex(6, 8, 5), new CoordIndex(5, 8, 1), new CoordIndex(1, 8, 4), new CoordIndex(4, 2, 1), new CoordIndex(2, 4, 3), new CoordIndex(4, 8, 7), new CoordIndex(7, 3, 4) }; IfcTriangulatedFaceSet triangulatedFaceSet = new IfcTriangulatedFaceSet(md, cartesianPointList3D, null, true, coordIndex, null); IfcColourRgbList colourRgbList = new IfcColourRgbList(md, new List<Color>() { Color.Red, Color.Green, Color.Yellow }); IfcIndexedColourMap indexedColourMap = new IfcIndexedColourMap(md, triangulatedFaceSet, colourRgbList, new List<int>() { 1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 1,1 }); md.NextObjectRecord = 300; IfcBuildingElementProxy buildingElementProxy = new IfcBuildingElementProxy(building, triangulatedFaceSet) { GlobalId = "25c34fWeL1NQux73WfnXox" }; }
private static IfcBuildingElementProxy ToIfc(this GeometricElement element, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var proxy = new IfcBuildingElementProxy(IfcGuid.ToIfcGuid(id), null, element.Name, $"A {element.GetType().Name} created in Hypar.", $"{element.GetType().FullName}", localPlacement, shape, null, IfcBuildingElementProxyTypeEnum.ELEMENT); return(proxy); }
public JsonBuildingElementProxyIfcElement(IfcBuildingElementProxy buildingElementProxy, JsonStoreyIfcElement parent, JsonConversionContext context) : base(buildingElementProxy) { userData.buildingStorey = new string[] { }; userData.siteId = parent.userData?.siteId; userData.projectId = parent.userData?.projectId; userData.buildingId = parent.userData?.buildingId; // Environnement element userData.buildingStorey = new[] { parent.id }; if (buildingElementProxy.Tag != null) { userData.tag = buildingElementProxy.Tag; } // Extract pset buildingElementProxy.ExtractPset(this); }
public T AddNewFacility(CcFacility cloneFacility = null, bool oneToOneCopy = false) { EventType enabledEventTypes = BaseObject.EventsEnabled; BaseObject.EventsEnabled = EventType.None; try { T facility = (T)AddNew(); // ------------------------------------------------------------------------------ // Annahme Anlage = IfcBuildingElementProxy IfcBuildingElementProxy ifcBuildingElementProxy = new IfcBuildingElementProxy(); facility.IfcObjectDefinition = ifcBuildingElementProxy; ifcBuildingElementProxy.Parent = this; Ifc4.Document document = this.GetParent <Ifc4.Document>(); if (document != null) { Entity entity = ifcBuildingElementProxy as Entity; if (entity != null) { entity.Id = document.GetNextSid(); document.IfcXmlDocument.Items.Add(entity); } IfcRoot ifcRoot = ifcBuildingElementProxy as IfcRoot; if (ifcRoot != null) { ifcRoot.GlobalId = document.GetNewGlobalId(); } } // ------------------------------------------------------------------------------ if (this.Parent.GetType() == typeof(Ifc4.IfcProject)) { IEnumerable <IfcRelAggregates> ifcRelAggregatesCollection = this.Document.IfcXmlDocument.Items.OfType <IfcRelAggregates>() .Where(item => item.RelatingObject != null && item.RelatingObject.Ref == ((Ifc4.IfcProject) this.Parent).Id).ToList(); if (ifcRelAggregatesCollection.Any()) { foreach (IfcRelAggregates ifcRelAggregates in ifcRelAggregatesCollection) { var relatedObject = ifcRelAggregates.RelatedObjects.Items.FirstOrDefault(item => item.Ref == ifcBuildingElementProxy.Id); if (relatedObject == null) { ifcRelAggregates.RelatedObjects.Items.Add(ifcBuildingElementProxy.RefInstance()); } } } else { IfcRelAggregates relAggregatesProject = new IfcRelAggregates() { GlobalId = Document.GetNewGlobalId(), // kann aktuell nur IfcProject sein RelatingObject = new Ifc4.IfcProject() { Ref = ((Ifc4.IfcProject) this.Parent).Id } }; relAggregatesProject.RelatedObjects = new IfcRelAggregatesRelatedObjects(); relAggregatesProject.RelatedObjects.Items.Add(ifcBuildingElementProxy.RefInstance()); this.Document.IfcXmlDocument.Items.Add(relAggregatesProject); } } // ------------------------------------------------------------------------------ if (this.Parent.GetType() == typeof(Ifc4.CcFacility)) { if (((Ifc4.CcFacility) this.Parent).IfcObjectDefinition != null) { Ifc4.IfcRelAggregates ifcRelAggregates = ((Ifc4.CcFacility) this.Parent).GetIfcRelAggregates(); ifcRelAggregates.RelatedObjects.Items.Add(ifcBuildingElementProxy.RefInstance()); } else if (((Ifc4.CcFacility) this.Parent).IfcSystem != null) { Ifc4.IfcRelAssignsToGroup ifcRelAssignsToGroup = ((Ifc4.CcFacility) this.Parent).GetIfcRelAssignsToGroup(); ifcRelAssignsToGroup.RelatedObjects.Items.Add(ifcBuildingElementProxy.RefInstance()); } } // ------------------------------------------------------------------------------ // assign facility properties from clipboard facility facility.AssignPropertiesFromFacility(cloneFacility, oneToOneCopy); // ------------------------------------------------------------------------------ return(facility); } catch (Exception exc) { return(default(T)); } finally { BaseObject.EventsEnabled = enabledEventTypes; } }
public static void ExtractPset(this IfcBuildingElementProxy element, JsonIfcElement newElement) => extractPsetBase(element, newElement, logId: "24");
/// <summary> /// You can give the name of the TestCase -> to build only them /// </summary> /// <param name="args">Testcases to expoert</param> /// <help> Testcases: Spatial_simple\n /// Railway_spatial\n Spatial_01\nPlacement_Local"\nGeomRepresentation_01\n /// \nGeomRepresentation_02\nGeomRepresentation_03\nGeomRepresentation_04 /// \nLocalPlacement_01\nLinearPlacement_02 /// /// </help> static void Main(string[] args) { //Var declaration string folder = "Unittest"; var testcasename = new List <string>(); testcasename.Add("Spatial_simple"); testcasename.Add("Railway_spatial"); testcasename.Add("Spatial_01"); testcasename.Add("Placement_Local"); testcasename.Add("GeomRepresentation_01"); testcasename.Add("GeomRepresentation_02"); testcasename.Add("GeomRepresentation_03"); testcasename.Add("GeomRepresentation_04"); //testcasename.Add("GeomRepresentation_05"); testcasename.Add("LocalPlacement_01"); testcasename.Add("LinearPlacement_02"); System.IO.Directory.CreateDirectory(".\\" + folder); //Help handling + single selection if (args.Length != 0) { //Help handling if (args.First().Equals("-?")) { foreach (var i in testcasename) { Console.WriteLine(i); } return; } //Select only selected ones testcasename = new List <string>(); foreach (var i in args) { testcasename.Add(i); } } foreach (var proname in testcasename) { var db = new DatabaseIfc(ModelView.Ifc4NotAssigned); db.Factory.Options.GenerateOwnerHistory = false; var site = new IfcSite(db, "site") { Guid = new Guid("aa4019f8-2584-44a1-a132-c17dfff69c41") }; var project = new IfcProject(db, proname) { Guid = new Guid("94d4ddac-9120-4fb9-bea0-7a414ee725d4") }; new IfcRelAggregates(project, new List <IfcObjectDefinition>() { site }) { Guid = new Guid("5e1fd0e5-b005-fe11-501e-5caff01dc1ad") }; //Some placements IfcAxis2Placement3D placement1 = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 2, 5, 1)); IfcLocalPlacement objectPlacement1 = new IfcLocalPlacement(site.ObjectPlacement, placement1); IfcAxis2Placement3D placement2 = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 10, 5, 1)); IfcLocalPlacement objectPlacement2 = new IfcLocalPlacement(site.ObjectPlacement, placement2); IfcAxis2Placement3D placement3 = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 15, 3, 6)); IfcLocalPlacement objectPlacement3 = new IfcLocalPlacement(site.ObjectPlacement, placement3); IfcAxis2Placement3D placement4 = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 5, 8, 3)); IfcLocalPlacement objectPlacement4 = new IfcLocalPlacement(site.ObjectPlacement, placement4); IfcAxis2Placement3D originaxis2place = new IfcAxis2Placement3D(db.Factory.Origin); IfcLocalPlacement origionobjplace = new IfcLocalPlacement(site.ObjectPlacement, originaxis2place); //Select the Testcases and fill them into the container switch (proname) { case "Spatial_simple": //initial File IfcBuilding building1 = new IfcBuilding(db, "building1") { Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bb42") }; building1.ObjectPlacement = objectPlacement1; IfcBuilding building2 = new IfcBuilding(db, "building2") { Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b441151337") }; building2.ObjectPlacement = objectPlacement2; //Write inital File db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //continue with the updated version IfcBuilding building3 = new IfcBuilding(db, "building3") { Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b441153531"), ObjectPlacement = objectPlacement3 }; break; case "Railway_spatial": //initial IfcSpatialZone spazone1 = new IfcSpatialZone(db, "Spatialzone1") { Guid = new Guid("42c7f4b2-177d-4875-88bb-d3b441153531"), ObjectPlacement = objectPlacement1 }; IfcSpatialZone spazone2 = new IfcSpatialZone(db, "Spatialzone2") { Guid = new Guid("42c7f4b2-1337-4875-88bb-d3b441153531"), ObjectPlacement = objectPlacement2 }; db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update IfcSpatialZone spazone3 = new IfcSpatialZone(db, "Spatialzone3") { Guid = new Guid("42c7f4b2-1337-4422-88bb-d3b441153531"), ObjectPlacement = objectPlacement3 }; IfcSpatialZone spazone4 = new IfcSpatialZone(db, "Spatialzone4") { Guid = new Guid("42c7f4b2-1337-4875-4242-d3b441153531"), ObjectPlacement = objectPlacement4 }; break; case "Spatial_01": //creating building and add parts to it building1 = new IfcBuilding(db, "building1") { Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bb42"), ObjectPlacement = objectPlacement1 }; IfcBuildingStorey buildingsto1 = new IfcBuildingStorey(building1, "Level1", 0) { Guid = new Guid("42c74222-1337-4875-4242-d3b441153531"), ObjectPlacement = objectPlacement2 }; building1.IsDecomposedBy.First().Guid = new Guid("42abcd22-1337-4875-4242-abcd41153531"); var profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); IfcExtrudedAreaSolid extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); IfcProductDefinitionShape shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); IfcWall wall = new IfcWall(buildingsto1, objectPlacement3, shape1) { Guid = new Guid("42aa4222-1337-aaaa-4242-d3aa41153531"), Name = "Wall1" }; wall.ContainedInStructure.Guid = new Guid("42c74222-1337-4875-4242-d3b44abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //update IfcBuildingStorey buildingsto2 = new IfcBuildingStorey(building1, "Level2", 0) { Guid = new Guid("42c74222-1337-4875-4242-bbbb41153531"), ObjectPlacement = objectPlacement4 }; // Reassign Wall to Storey2 wall.ContainedInStructure.RelatingStructure = buildingsto2; break; case "Placement_Local": //Initial set profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); //Wall at origin IfcWall wall2 = new IfcWall(site, origionobjplace, shape1) { Guid = new Guid("42aa4222-1337-aaaa-4242-d3aa41153531"), Name = "Wall1" }; wall2.ContainedInStructure.Guid = new Guid("42cab222-1337-4875-4242-d3b44abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update IfcAxis2Placement3D wallaxisplace = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 2, 3, 0)); wall2.ObjectPlacement = new IfcLocalPlacement(site.ObjectPlacement, wallaxisplace); break; case "GeomRepresentation_01": //init profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); IfcRectangleProfileDef profile2 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); IfcExtrudedAreaSolid extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35); IfcProductDefinitionShape shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); var proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid1", Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3abed15bbaa") }; proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b44abcd531"); var proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2) { Name = "Cuboid2", Guid = new Guid("f8e196cb-c7d9-4d53-9885-0f687706abcd") }; proxy2.ContainedInStructure.Guid = new Guid("42cab222-1337-4875-4242-00004abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update proxy2.Representation = shape1; shape2.Dispose(true); //Remove orphaned entries break; case "GeomRepresentation_02": //init profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); profile2 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35); shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid1", Guid = new Guid("fbcba4b2-1c7d-4875-88bb-d3abed15bbaa") }; proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b00abcd531"); proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2) { Name = "Cuboid2", Guid = new Guid("f821963b-c7d9-4d53-9885-0f87cd6abcda") }; proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3414abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update extrudedAreaSolid2.Depth = 3; break; case "GeomRepresentation_03": //init profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid_extrudedArea", Guid = new Guid("fbcba4b2-1c7d-0000-88bb-d3abed15bbaa") }; proxy1.ContainedInStructure.Guid = new Guid("00011222-1337-4875-4242-d1114abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update profile1.Dispose(false); // Remove profile var profile3 = new IfcCircleProfileDef(db, "CylinderProfileDef", 4); extrudedAreaSolid1.SweptArea = profile3; proxy1.Name = "Cylinder_extrudedArea"; break; case "GeomRepresentation_04": //init profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid_extrudedArea", Guid = new Guid("fbcba4b2-1c7d-0000-88bb-d3abed15bbaa") }; proxy1.ContainedInStructure.Guid = new Guid("00011222-1337-4875-4242-d1114abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update var points = new List <IfcCartesianPoint>(); points.Add(new IfcCartesianPoint(db, -2, -3, 0)); points.Add(new IfcCartesianPoint(db, -2, 3, 0)); points.Add(new IfcCartesianPoint(db, 2, 3, 0)); points.Add(new IfcCartesianPoint(db, 2, -3, 0)); points.Add(new IfcCartesianPoint(db, -2, -3, 1.35)); points.Add(new IfcCartesianPoint(db, -2, 3, 1.35)); points.Add(new IfcCartesianPoint(db, 2, 3, 1.35)); points.Add(new IfcCartesianPoint(db, 2, -3, 1.35)); var polyloop = new List <IfcPolyLoop>(); polyloop.Add(new IfcPolyLoop(points[0], points[1], points[2], points[3])); polyloop.Add(new IfcPolyLoop(points[0], points[4], points[5], points[1])); polyloop.Add(new IfcPolyLoop(points[0], points[4], points[7], points[3])); polyloop.Add(new IfcPolyLoop(points[4], points[5], points[6], points[7])); polyloop.Add(new IfcPolyLoop(points[1], points[5], points[6], points[2])); polyloop.Add(new IfcPolyLoop(points[3], points[7], points[6], points[2])); var faceouter = new List <IfcFaceOuterBound>(); foreach (var i in polyloop) { faceouter.Add(new IfcFaceOuterBound(i, true)); } var face = new List <IfcFace>(); foreach (var j in faceouter) { face.Add(new IfcFace(j)); } var closedshell = new IfcClosedShell(face); var brep = new IfcFacetedBrep(closedshell); shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(brep)); proxy1.Representation = shape2; break; case "GeomRepresentation_05": var points1 = new List <IfcCartesianPoint>(); points1.Add(new IfcCartesianPoint(db, -2, -3, 0)); points1.Add(new IfcCartesianPoint(db, -2, 3, 0)); points1.Add(new IfcCartesianPoint(db, 2, 3, 0)); points1.Add(new IfcCartesianPoint(db, 2, -3, 0)); var points2 = new List <IfcCartesianPoint>(); points2.Add(new IfcCartesianPoint(db, -2, -3, 1.35)); points2.Add(new IfcCartesianPoint(db, -2, 3, 1.35)); points2.Add(new IfcCartesianPoint(db, 2, 3, 1.35)); points2.Add(new IfcCartesianPoint(db, 2, -3, 1.35)); polyloop = new List <IfcPolyLoop>(); polyloop.Add(new IfcPolyLoop(points1)); polyloop.Add(new IfcPolyLoop(points2)); break; case "LocalPlacement_01": //init profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); profile2 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35); shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid1", Guid = new Guid("fbcba4b2-1c7d-4815-88bb-d3abed15bbaa") }; proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b00abcd531"); proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2) { Name = "Cuboid2", Guid = new Guid("f821963b-c7d9-4d53-9825-0f87cd6abcda") }; proxy1.ContainedInStructure.Guid = new Guid("000ab242-1337-4875-4242-d3414abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //update var point1 = new IfcCartesianPoint(db, 2, 2, 2); placement1.Location = point1; break; case "LinearPlacement_02": profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); profile2 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6); extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35); shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); IfcLine line1 = new IfcLine(new IfcCartesianPoint(db, 1, 1, 1) , new IfcVector(new IfcDirection(db, 1, 1), 20)); IfcLine line2 = new IfcLine(new IfcCartesianPoint(db, 1, -1, -1) , new IfcVector(new IfcDirection(db, -1, 1), 20)); var alignment1 = new IfcAlignment(site, line1) { Name = "Alignment1", Guid = new Guid("fbcba4b2-1cdd-48d5-88bb-d3aced15bbaa") }; var alignment2 = new IfcAlignment(site, line2) { Name = "Alignment2", Guid = new Guid("f111a4b2-1c7d-4815-88bb-d3aced15bbaa") }; var distn1 = new IfcPointByDistanceExpression(4, line1); var distn2 = new IfcPointByDistanceExpression(2, line2); //Deprecated but should be right for IFC4 var linearplace1 = new IfcLinearPlacement(line1, distn1) { Orientation = new IfcOrientationExpression(new IfcDirection(db, 0.5, 0.24), new IfcDirection(db, -0.24, 0.5)) }; var linearplace2 = new IfcLinearPlacement(line2, distn2) { Orientation = new IfcOrientationExpression(new IfcDirection(db, 0.75, 0.24), new IfcDirection(db, -0.24, 0.66)) }; proxy1 = new IfcBuildingElementProxy(site, linearplace1, shape1) { Name = "Cuboid1", Guid = new Guid("fbcba4b2-1c7d-4815-88bb-d3aced15bbaa") }; proxy1.ContainedInStructure.Guid = new Guid("000cc222-1337-4875-4242-d3b00abcd531"); proxy2 = new IfcBuildingElementProxy(site, linearplace2, shape2) { Name = "Cuboid2", Guid = new Guid("f821963b-c7d9-4d53-98a5-0f8ccd6abcda") }; proxy1.ContainedInStructure.Guid = new Guid("000ccc42-1337-4875-4242-d3414abcd531"); db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml"); //Update IfcLine line3 = new IfcLine(new IfcCartesianPoint(db, 0, 1, 0) , new IfcVector(new IfcDirection(db, 0, 5, 2), 15)); var distn3 = new IfcPointByDistanceExpression(4, line3); linearplace1.PlacementMeasuredAlong = line3; linearplace1.Distance = distn3; break; default: //exit return; } db.WriteFile(".\\" + folder + "\\Update_" + proname + ".ifc"); db.WriteXmlFile(".\\" + folder + "\\Update_" + proname + ".ifcxml"); } }