/// <summary> /// Convert a wall to an IfcWallStandardCase /// </summary> /// <param name="wall"></param> /// <param name="context"></param> /// <param name="doc"></param> /// <returns></returns> private static IfcWallStandardCase ToIfcWallStandardCase(this Wall wall, IfcRepresentationContext context, Document doc) { var sweptArea = wall.CenterLine.Thicken(wall.Thickness()).ToIfcArbitraryClosedProfileDef(doc); var extrudeDirection = Vector3.ZAxis.ToIfcDirection(); // We don't use the Wall's transform for positioning, because // our walls have a transform that lays the wall "flat". Just // use a identity transform. var position = new Transform().ToIfcAxis2Placement3D(doc); var repItem = new IfcExtrudedAreaSolid(sweptArea, position, extrudeDirection, new IfcPositiveLengthMeasure(wall.Height)); var rep = new IfcShapeRepresentation(context, "Body", "SweptSolid", new List <IfcRepresentationItem> { repItem }); var productRep = new IfcProductDefinitionShape(new List <IfcRepresentation> { rep }); var id = IfcGuid.ToIfcGuid(Guid.NewGuid()); var localPlacement = new Transform().ToIfcLocalPlacement(doc); var ifcWall = new IfcWallStandardCase(new IfcGloballyUniqueId(id), null, wall.Name, null, null, localPlacement, productRep, null); doc.AddEntity(sweptArea); doc.AddEntity(extrudeDirection); doc.AddEntity(position); doc.AddEntity(repItem); doc.AddEntity(rep); doc.AddEntity(localPlacement); doc.AddEntity(productRep); doc.AddEntity(ifcWall); return(ifcWall); }
/// <summary> /// Convert an IfcWallStandardCase to a Wall. /// </summary> /// <param name="wall">An IfcWallStandardCase.</param> /// <param name="openings">A collection of IfcOpeningElement belonging to this wall.</param> /// <param name="wallType">The wall's wall type.</param> private static Wall ToWall(this IfcWallStandardCase wall, IEnumerable <IfcOpeningElement> openings, WallType wallType) { var transform = new Transform(); transform.Concatenate(wall.ObjectPlacement.ToTransform()); // An extruded face solid. var solid = wall.RepresentationsOfType <IfcExtrudedAreaSolid>().FirstOrDefault(); // A centerline wall with material layers. // var axis = (Polyline)wall.RepresentationsOfType<IfcPolyline>().FirstOrDefault().ToICurve(false); foreach (var cis in wall.ContainedInStructure) { cis.RelatingStructure.ObjectPlacement.ToTransform().Concatenate(transform); } // var os = openings.Select(o=>o.ToOpening()).ToArray(); if (solid != null) { var c = solid.SweptArea.ToICurve(); if (c is Polygon) { transform.Concatenate(solid.Position.ToTransform()); var result = new Wall(new Profile((Polygon)c), wallType, (IfcLengthMeasure)solid.Depth, transform); result.Name = wall.Name; return(result); } } return(null); }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(ModelView.Ifc4DesignTransfer); IfcBuilding building = new IfcBuilding(db, "IfcBuilding") { }; IfcProject project = new IfcProject(building, "IfcProject", IfcUnitAssignment.Length.Millimetre) { }; //IfcBuildingStorey storey = new IfcBuildingStorey(building, "Ground Floor", 0); IfcMaterial masonryFinish = new IfcMaterial(db, "Masonry - Brick - Brown"); IfcMaterial masonry = new IfcMaterial(db, "Masonry"); IfcMaterialLayer layerFinish = new IfcMaterialLayer(masonryFinish, 110, "Finish"); IfcMaterialLayer airInfiltrationBarrier = new IfcMaterialLayer(db, 50, "Air Infiltration Barrier") { IsVentilated = IfcLogicalEnum.TRUE }; IfcMaterialLayer structure = new IfcMaterialLayer(masonry, 110, "Core"); string name = "Double Brick - 270"; IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(new List <IfcMaterialLayer>() { layerFinish, airInfiltrationBarrier, structure }, name); IfcMaterialLayerSetUsage materialLayerSetUsage = new IfcMaterialLayerSetUsage(materialLayerSet, IfcLayerSetDirectionEnum.AXIS2, IfcDirectionSenseEnum.POSITIVE, 0); db.NextObjectRecord = 300; IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED) { }; IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, materialLayerSetUsage, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), 5000, 2000) { }; }
protected override void GenerateInstance(IfcBuilding building) { DatabaseIfc db = building.Database; IfcMaterial masonryFinish = new IfcMaterial(db, "Masonry - Brick - Brown"); IfcMaterial masonry = new IfcMaterial(db, "Masonry"); IfcMaterialLayer layerFinish = new IfcMaterialLayer(masonryFinish, 110, "Finish"); IfcMaterialLayer airInfiltrationBarrier = new IfcMaterialLayer(db, 50, "Air Infiltration Barrier") { IsVentilated = IfcLogicalEnum.TRUE }; IfcMaterialLayer structure = new IfcMaterialLayer(masonry, 110, "Core"); string name = "Double Brick - 270"; IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(new List <IfcMaterialLayer>() { layerFinish, airInfiltrationBarrier, structure }, name); db.NextObjectRecord = 300; IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED); IfcMaterialLayerSetUsage layerSetUsage = new IfcMaterialLayerSetUsage(materialLayerSet, IfcLayerSetDirectionEnum.AXIS2, IfcDirectionSenseEnum.POSITIVE, -materialLayerSet.MaterialLayers.Sum(x => x.LayerThickness) / 2.0); IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, layerSetUsage, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), 5000, 2000); db.Context.AddDeclared(wallType); //Unique ids assigned to generate constant IfcScript sample files, remove otherwise wallType.GlobalId = "2aG1gZj7PD2PztLOx2$IVX"; wallStandardCase.GlobalId = "0DWgwt6o1FOx7466fPk$jl"; materialLayerSet.Associates.GlobalId = "36U74BIPDD89cYkx9bkV$Y"; wallStandardCase.MaterialSelect.Associates.GlobalId = "1BYoVhjtLADPUZYzipA826"; }
/// <summary> /// Convert an IfcWallStandardCase to a Wall. /// </summary> /// <param name="wall"></param> public static Wall ToWall(this IfcWallStandardCase wall) { var transform = new Transform(); transform.Concatenate(wall.ObjectPlacement.ToTransform()); var solid = wall.RepresentationsOfType <IfcExtrudedAreaSolid>().FirstOrDefault(); foreach (var cis in wall.ContainedInStructure) { cis.RelatingStructure.ObjectPlacement.ToTransform().Concatenate(transform); } var material = new Material("wall", Colors.Green); if (solid != null) { var c = solid.SweptArea.ToICurve(); if (c is Polygon) { transform.Concatenate(solid.Position.ToTransform()); var result = new Wall(new Profile((Polygon)c), (IfcLengthMeasure)solid.Depth, material, transform); result.Name = wall.Name; return(result); } } return(null); }
protected override void GenerateData(STPModelData md, IfcBuilding building) { IfcMaterial masonryFinish = new IfcMaterial(md, "Masonry - Brick - Brown", "", ""); IfcMaterial masonry = new IfcMaterial(md, "Masonry", "", ""); IfcMaterialLayer layerFinish = new IfcMaterialLayer(md, masonryFinish, 110, false, "Finish", "", "", 0); IfcMaterialLayer airInfiltrationBarrier = new IfcMaterialLayer(md, null, 50, true, "Air Infiltration Barrier", "", "", 0); IfcMaterialLayer structure = new IfcMaterialLayer(md, masonry, 110, false, "Core", "", "", 0); string name = "Double Brick - 270"; IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(new List <IfcMaterialLayer>() { layerFinish, airInfiltrationBarrier, structure }, name, ""); materialLayerSet.Associates.GlobalId = "36U74BIPDD89cYkx9bkV$Y"; md.NextObjectRecord = 300; IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED) { GlobalId = "2aG1gZj7PD2PztLOx2$IVX" }; wallType.ObjectTypeOf.GlobalId = "1$EkFElNT8TB_VUVG1FtMe"; IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, wallType, new Line(0, 0, 0, 5000, 0, 0), 2000, 0, true, null) { GlobalId = "0DWgwt6o1FOx7466fPk$jl" }; wallStandardCase.MaterialSelect.Associates.GlobalId = "1BYoVhjtLADPUZYzipA826"; }
private void CreateSimpleProperty(IfcStore model, IfcWallStandardCase wall) { var ifcPropertySingleValue = model.Instances.New <IfcPropertySingleValue>(psv => { psv.Name = "IfcPropertySingleValue:Time"; psv.Description = ""; psv.NominalValue = new IfcTimeMeasure(150.0); psv.Unit = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.TIMEUNIT; siu.Name = IfcSIUnitName.SECOND; }); }); //lets create the IfcElementQuantity var ifcPropertySet = model.Instances.New <IfcPropertySet>(ps => { ps.Name = "Test:IfcPropertySet"; ps.Description = "Property Set"; ps.HasProperties.Add(ifcPropertySingleValue); }); //need to create the relationship model.Instances.New <IfcRelDefinesByProperties>(rdbp => { rdbp.Name = "Property Association"; rdbp.Description = "IfcPropertySet associated to wall"; rdbp.RelatedObjects.Add(wall); rdbp.RelatingPropertyDefinition = ifcPropertySet; }); }
internal static Wall ToWall(this IfcWallStandardCase wall, IEnumerable <IfcOpeningElement> openings) { var transform = new Transform(); transform.Concatenate(wall.ObjectPlacement.ToTransform()); var os = openings.Select(o => o.ToOpening()); // An extruded face solid. var solid = wall.RepresentationsOfType <IfcExtrudedAreaSolid>().FirstOrDefault(); if (solid == null) { // It's possible that the rep is a boolean. var boolean = wall.RepresentationsOfType <IfcBooleanClippingResult>().FirstOrDefault(); if (boolean != null) { solid = boolean.FirstOperand.Choice as IfcExtrudedAreaSolid; if (solid == null) { solid = boolean.SecondOperand.Choice as IfcExtrudedAreaSolid; } } // if(solid == null) // { // throw new Exception("No usable solid was found when converting an IfcWallStandardCase to a Wall."); // } } // A centerline wall with material layers. // var axis = (Polyline)wall.RepresentationsOfType<IfcPolyline>().FirstOrDefault().ToICurve(false); foreach (var cis in wall.ContainedInStructure) { cis.RelatingStructure.ObjectPlacement.ToTransform().Concatenate(transform); } if (solid != null) { var c = solid.SweptArea.ToCurve(); if (c is Polygon) { transform.Concatenate(solid.Position.ToTransform()); var result = new Wall((Polygon)c, (IfcLengthMeasure)solid.Depth, null, transform, null, false, IfcGuid.FromIfcGUID(wall.GlobalId), wall.Name); result.Openings.AddRange(os); return(result); } } return(null); }
private static IfcProduct ToIfc(this StandardWall wall, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcWall = new IfcWallStandardCase(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, wall.Name, null, null, localPlacement, shape, null); return(ifcWall); }
/// <summary> /// Add some properties to the wall, /// </summary> /// <param name="model">XbimModel</param> /// <param name="wall"></param> private void AddPropertiesToWall(IfcStore model, IfcWallStandardCase wall) { using (var txn = model.BeginTransaction("Create Wall")) { CreateSimpleProperty(model, wall); txn.Commit(); } }
/// <summary> /// This sample demonstrates the minimum steps to create a compliant IFC model that contains a single standard case wall /// </summary> static int Main() { //first create and initialise a model called Hello Wall Console.WriteLine("Initialising the IFC Project...."); using (var model = CreateandInitModel("HelloWall")) { if (model != null) { IfcBuilding building = CreateBuilding(model, "Default Building"); IfcBuildingStorey storey = CreateStorey(building); IfcWallStandardCase wall = CreateWall(model, 4000, 300, 2400); if (wall != null) { AddPropertiesToWall(model, wall); } using (var txn = model.BeginTransaction("Add Wall")) { building.AddToSpatialDecomposition(storey); storey.AddElement(wall); txn.Commit(); } if (wall != null) { try { Console.WriteLine("Standard Wall successfully created...."); //write the Ifc File model.SaveAs("HelloWallIfc4.ifc", IfcStorageType.Ifc); Console.WriteLine("HelloWallIfc4.ifc has been successfully written"); } catch (Exception e) { Console.WriteLine("Failed to save HelloWall.ifc"); Console.WriteLine(e.Message); } } } else { Console.WriteLine("Failed to initialise the model"); } } Console.WriteLine("Press any key to exit to view the IFC file...."); Console.ReadKey(); LaunchNotepad("HelloWallIfc4.ifc"); return(0); }
private static IfcProduct ToIfc(this StandardWall wall, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcWall = new IfcWallStandardCase(IfcGuid.ToIfcGuid(id), null, wall.Name, null, null, localPlacement, shape, null, IfcWallTypeEnum.NOTDEFINED); return(ifcWall); }
/// <summary> /// Add some properties to the wall, /// </summary> /// <param name="model">XbimModel</param> private void AddPropertiesToWall(XbimModel model, IfcWallStandardCase wall) { using (XbimReadWriteTransaction txn = model.BeginTransaction("Create Wall")) { IfcOwnerHistory ifcOwnerHistory = model.IfcProject.OwnerHistory; //we just use the project owner history for the properties, saves creating one CreateElementQuantity(model, wall, ifcOwnerHistory); CreateSimpleProperty(model, wall, ifcOwnerHistory); //if (model.Validate(txn.Modified(), Console.Out) == 0) //{ txn.Commit(); //} var xx = model.Instances.OfType <IfcPropertyReferenceValue>(); } }
protected override void GenerateData(STPModelData md, IfcBuilding building) { IfcMaterial masonryFinish = new IfcMaterial(md, "Masonry - Brick - Brown", "", ""); IfcMaterial masonry = new IfcMaterial(md, "Masonry", "", ""); IfcMaterialLayer layerFinish = new IfcMaterialLayer(md, masonryFinish, 110, false, "Finish", "", "", 0); IfcMaterialLayer airInfiltrationBarrier = new IfcMaterialLayer(md, null, 50, true, "Air Infiltration Barrier", "", "", 0); IfcMaterialLayer structure = new IfcMaterialLayer(md, masonry, 110, false, "Core", "", "", 0); string name = "Double Brick - 270"; IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet( new List<IfcMaterialLayer>() { layerFinish, airInfiltrationBarrier, structure }, name, ""); materialLayerSet.Associates.GlobalId = "36U74BIPDD89cYkx9bkV$Y"; md.NextObjectRecord = 300; IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED) { GlobalId = "2aG1gZj7PD2PztLOx2$IVX" }; wallType.ObjectTypeOf.GlobalId = "1$EkFElNT8TB_VUVG1FtMe"; IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, wallType, new Line(0, 0, 0, 5000, 0, 0), 2000, 0, true, null) { GlobalId = "0DWgwt6o1FOx7466fPk$jl" }; wallStandardCase.MaterialSelect.Associates.GlobalId = "1BYoVhjtLADPUZYzipA826"; }
/// <summary> /// This sample demonstrates the minimum steps to create a compliant IFC model that contains a single standard case wall /// </summary> /// <param name="args"></param> public void Run() { //first create and initialise a model called Hello Wall Console.WriteLine("Initialising the IFC Project...."); XbimModel model = CreateandInitModel("HelloWall"); if (model != null) { IfcBuilding building = CreateBuilding(model, "Default Building", 2000); IfcWallStandardCase wall = CreateWall(model, 4000, 300, 2400); if (wall != null) { AddPropertiesToWall(model, wall); } using (XbimReadWriteTransaction txn = model.BeginTransaction("Add Wall")) { building.AddElement(wall); txn.Commit(); } if (wall != null) { try { Console.WriteLine("Standard Wall successfully created...."); //write the Ifc File model.SaveAs("HelloWall.ifc", XbimStorageType.IFC); Console.WriteLine("HelloWall.ifc has been successfully written"); } catch (Exception e) { Console.WriteLine("Failed to save HelloWall.ifc"); Console.WriteLine(e.Message); } } } else { Console.WriteLine("Failed to initialise the model"); } Console.WriteLine("Press any key to exit...."); Console.ReadKey(); }
private static void CreateElementQuantity(IfcStore model, IfcWallStandardCase wall) { //Create a IfcElementQuantity //first we need a IfcPhysicalSimpleQuantity,first will use IfcQuantityLength var ifcQuantityArea = model.Instances.New <IfcQuantityLength>(qa => { qa.Name = "IfcQuantityArea:Area"; qa.Description = ""; qa.Unit = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.LENGTHUNIT; siu.Prefix = IfcSIPrefix.MILLI; siu.Name = IfcSIUnitName.METRE; }); qa.LengthValue = 100.0; }); //next quantity IfcQuantityCount using IfcContextDependentUnit var ifcContextDependentUnit = model.Instances.New <IfcContextDependentUnit>(cd => { cd.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cd.UnitType = IfcUnitEnum.LENGTHUNIT; cd.Name = "Elephants"; }); var ifcQuantityCount = model.Instances.New <IfcQuantityCount>(qc => { qc.Name = "IfcQuantityCount:Elephant"; qc.CountValue = 12; qc.Unit = ifcContextDependentUnit; }); //next quantity IfcQuantityLength using IfcConversionBasedUnit var ifcConversionBasedUnit = model.Instances.New <IfcConversionBasedUnit>(cbu => { cbu.ConversionFactor = model.Instances.New <IfcMeasureWithUnit>(mu => { mu.ValueComponent = new IfcRatioMeasure(25.4); mu.UnitComponent = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.LENGTHUNIT; siu.Prefix = IfcSIPrefix.MILLI; siu.Name = IfcSIUnitName.METRE; }); }); cbu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cbu.UnitType = IfcUnitEnum.LENGTHUNIT; cbu.Name = "Inch"; }); var ifcQuantityLength = model.Instances.New <IfcQuantityLength>(qa => { qa.Name = "IfcQuantityLength:Length"; qa.Description = ""; qa.Unit = ifcConversionBasedUnit; qa.LengthValue = 24.0; }); //lets create the IfcElementQuantity var ifcElementQuantity = model.Instances.New <IfcElementQuantity>(eq => { eq.Name = "Test:IfcElementQuantity"; eq.Description = "Measurement quantity"; eq.Quantities.Add(ifcQuantityArea); eq.Quantities.Add(ifcQuantityCount); eq.Quantities.Add(ifcQuantityLength); }); //need to create the relationship model.Instances.New <IfcRelDefinesByProperties>(rdbp => { rdbp.Name = "Area Association"; rdbp.Description = "IfcElementQuantity associated to wall"; rdbp.RelatedObjects.Add(wall); rdbp.RelatingPropertyDefinition = ifcElementQuantity; }); }
private static void CreateSimpleProperty(IfcStore model, IfcWallStandardCase wall) { var ifcPropertySingleValue = model.Instances.New <IfcPropertySingleValue>(psv => { psv.Name = "IfcPropertySingleValue:Time"; psv.Description = ""; psv.NominalValue = new IfcTimeMeasure(150.0); psv.Unit = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.TIMEUNIT; siu.Name = IfcSIUnitName.SECOND; }); }); var ifcPropertyEnumeratedValue = model.Instances.New <IfcPropertyEnumeratedValue>(pev => { pev.Name = "IfcPropertyEnumeratedValue:Music"; pev.EnumerationReference = model.Instances.New <IfcPropertyEnumeration>(pe => { pe.Name = "Notes"; pe.EnumerationValues.Add(new IfcLabel("Do")); pe.EnumerationValues.Add(new IfcLabel("Re")); pe.EnumerationValues.Add(new IfcLabel("Mi")); pe.EnumerationValues.Add(new IfcLabel("Fa")); pe.EnumerationValues.Add(new IfcLabel("So")); pe.EnumerationValues.Add(new IfcLabel("La")); pe.EnumerationValues.Add(new IfcLabel("Ti")); }); pev.EnumerationValues.Add(new IfcLabel("Do")); pev.EnumerationValues.Add(new IfcLabel("Re")); pev.EnumerationValues.Add(new IfcLabel("Mi")); }); var ifcPropertyBoundedValue = model.Instances.New <IfcPropertyBoundedValue>(pbv => { pbv.Name = "IfcPropertyBoundedValue:Mass"; pbv.Description = ""; pbv.UpperBoundValue = new IfcMassMeasure(5000.0); pbv.LowerBoundValue = new IfcMassMeasure(1000.0); pbv.Unit = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.MASSUNIT; siu.Name = IfcSIUnitName.GRAM; siu.Prefix = IfcSIPrefix.KILO; }); }); var definingValues = new List <IfcReal> { new IfcReal(100.0), new IfcReal(200.0), new IfcReal(400.0), new IfcReal(800.0), new IfcReal(1600.0), new IfcReal(3200.0), }; var definedValues = new List <IfcReal> { new IfcReal(20.0), new IfcReal(42.0), new IfcReal(46.0), new IfcReal(56.0), new IfcReal(60.0), new IfcReal(65.0), }; var ifcPropertyTableValue = model.Instances.New <IfcPropertyTableValue>(ptv => { ptv.Name = "IfcPropertyTableValue:Sound"; foreach (var item in definingValues) { ptv.DefiningValues.Add(item); } foreach (var item in definedValues) { ptv.DefinedValues.Add(item); } ptv.DefinedUnit = model.Instances.New <IfcContextDependentUnit>(cd => { cd.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cd.UnitType = IfcUnitEnum.FREQUENCYUNIT; cd.Name = "dB"; }); }); var listValues = new List <IfcLabel> { new IfcLabel("Red"), new IfcLabel("Green"), new IfcLabel("Blue"), new IfcLabel("Pink"), new IfcLabel("White"), new IfcLabel("Black"), }; var ifcPropertyListValue = model.Instances.New <IfcPropertyListValue>(plv => { plv.Name = "IfcPropertyListValue:Colours"; foreach (var item in listValues) { plv.ListValues.Add(item); } }); var ifcMaterial = model.Instances.New <IfcMaterial>(m => { m.Name = "Brick"; }); var ifcPrValueMaterial = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Material"; prv.PropertyReference = ifcMaterial; }); var ifcMaterialList = model.Instances.New <IfcMaterialList>(ml => { ml.Materials.Add(ifcMaterial); ml.Materials.Add(model.Instances.New <IfcMaterial>(m => { m.Name = "Cavity"; })); ml.Materials.Add(model.Instances.New <IfcMaterial>(m => { m.Name = "Block"; })); }); var ifcMaterialLayer = model.Instances.New <IfcMaterialLayer>(ml => { ml.Material = ifcMaterial; ml.LayerThickness = 100.0; }); var ifcPrValueMatLayer = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:MaterialLayer"; prv.PropertyReference = ifcMaterialLayer; }); var ifcDocumentReference = model.Instances.New <IfcDocumentReference>(dr => { dr.Name = "Document"; dr.Location = "c://Documents//TheDoc.Txt"; }); var ifcPrValueRef = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Document"; prv.PropertyReference = ifcDocumentReference; }); var ifcTimeSeries = model.Instances.New <IfcRegularTimeSeries>(ts => { ts.Name = "Regular Time Series"; ts.Description = "Time series of events"; ts.StartTime = new IfcDateTime("2015-02-14T12:01:01"); ts.EndTime = new IfcDateTime("2015-05-15T12:01:01"); ts.TimeSeriesDataType = IfcTimeSeriesDataTypeEnum.CONTINUOUS; ts.DataOrigin = IfcDataOriginEnum.MEASURED; ts.TimeStep = 604800; //7 days in secs }); var ifcPrValueTimeSeries = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:TimeSeries"; prv.PropertyReference = ifcTimeSeries; }); var ifcAddress = model.Instances.New <IfcPostalAddress>(a => { a.InternalLocation = "Room 101"; a.AddressLines.AddRange(new[] { new IfcLabel("12 New road"), new IfcLabel("DoxField") }); a.Town = "Sunderland"; a.PostalCode = "DL01 6SX"; }); var ifcPrValueAddress = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Address"; prv.PropertyReference = ifcAddress; }); var ifcTelecomAddress = model.Instances.New <IfcTelecomAddress>(a => { a.TelephoneNumbers.Add(new IfcLabel("01325 6589965")); a.ElectronicMailAddresses.Add(new IfcLabel("*****@*****.**")); }); var ifcPrValueTelecom = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Telecom"; prv.PropertyReference = ifcTelecomAddress; }); //lets create the IfcElementQuantity var ifcPropertySet = model.Instances.New <IfcPropertySet>(ps => { ps.Name = "Test:IfcPropertySet"; ps.Description = "Property Set"; ps.HasProperties.Add(ifcPropertySingleValue); ps.HasProperties.Add(ifcPropertyEnumeratedValue); ps.HasProperties.Add(ifcPropertyBoundedValue); ps.HasProperties.Add(ifcPropertyTableValue); ps.HasProperties.Add(ifcPropertyListValue); ps.HasProperties.Add(ifcPrValueMaterial); ps.HasProperties.Add(ifcPrValueMatLayer); ps.HasProperties.Add(ifcPrValueRef); ps.HasProperties.Add(ifcPrValueTimeSeries); ps.HasProperties.Add(ifcPrValueAddress); ps.HasProperties.Add(ifcPrValueTelecom); }); //need to create the relationship model.Instances.New <IfcRelDefinesByProperties>(rdbp => { rdbp.Name = "Property Association"; rdbp.Description = "IfcPropertySet associated to wall"; rdbp.RelatedObjects.Add(wall); rdbp.RelatingPropertyDefinition = ifcPropertySet; }); }
private static void CreateSimpleProperty(XbimModel model, IfcWallStandardCase wall, IfcOwnerHistory ifcOwnerHistory) { IfcPropertySingleValue ifcPropertySingleValue = model.Instances.New <IfcPropertySingleValue>(psv => { psv.Name = "IfcPropertySingleValue:Time"; psv.Description = ""; psv.NominalValue = new IfcTimeMeasure(150.0); psv.Unit = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.TIMEUNIT; siu.Name = IfcSIUnitName.SECOND; siu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 0; de.TimeExponent = 1; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); }); IfcPropertyEnumeratedValue ifcPropertyEnumeratedValue = model.Instances.New <IfcPropertyEnumeratedValue>(pev => { pev.Name = "IfcPropertyEnumeratedValue:Music"; pev.EnumerationReference = model.Instances.New <IfcPropertyEnumeration>(pe => { pe.Name = "Notes"; pe.EnumerationValues.Add(new IfcLabel("Do")); pe.EnumerationValues.Add(new IfcLabel("Re")); pe.EnumerationValues.Add(new IfcLabel("Mi")); pe.EnumerationValues.Add(new IfcLabel("Fa")); pe.EnumerationValues.Add(new IfcLabel("So")); pe.EnumerationValues.Add(new IfcLabel("La")); pe.EnumerationValues.Add(new IfcLabel("Ti")); }); pev.EnumerationValues.Add(new IfcLabel("Do")); pev.EnumerationValues.Add(new IfcLabel("Re")); pev.EnumerationValues.Add(new IfcLabel("Mi")); }); IfcPropertyBoundedValue ifcPropertyBoundedValue = model.Instances.New <IfcPropertyBoundedValue>(pbv => { pbv.Name = "IfcPropertyBoundedValue:Mass"; pbv.Description = ""; pbv.UpperBoundValue = new IfcMassMeasure(5000.0); pbv.LowerBoundValue = new IfcMassMeasure(1000.0); pbv.Unit = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.MASSUNIT; siu.Name = IfcSIUnitName.GRAM; siu.Prefix = IfcSIPrefix.KILO; siu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 1; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); }); List <IfcReal> definingValues = new List <IfcReal>() { new IfcReal(100.0), new IfcReal(200.0), new IfcReal(400.0), new IfcReal(800.0), new IfcReal(1600.0), new IfcReal(3200.0), }; List <IfcReal> definedValues = new List <IfcReal>() { new IfcReal(20.0), new IfcReal(42.0), new IfcReal(46.0), new IfcReal(56.0), new IfcReal(60.0), new IfcReal(65.0), }; IfcPropertyTableValue ifcPropertyTableValue = model.Instances.New <IfcPropertyTableValue>(ptv => { ptv.Name = "IfcPropertyTableValue:Sound"; foreach (var item in definingValues) { ptv.DefiningValues.Add(item); } foreach (var item in definedValues) { ptv.DefinedValues.Add(item); } ptv.DefinedUnit = model.Instances.New <IfcContextDependentUnit>(cd => { cd.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cd.UnitType = IfcUnitEnum.FREQUENCYUNIT; cd.Name = "dB"; }); }); List <IfcLabel> listValues = new List <IfcLabel>() { new IfcLabel("Red"), new IfcLabel("Green"), new IfcLabel("Blue"), new IfcLabel("Pink"), new IfcLabel("White"), new IfcLabel("Black"), }; IfcPropertyListValue ifcPropertyListValue = model.Instances.New <IfcPropertyListValue>(plv => { plv.Name = "IfcPropertyListValue:Colours"; foreach (var item in listValues) { plv.ListValues.Add(item); } }); IfcMaterial IfcMaterial = model.Instances.New <IfcMaterial>(m => { m.Name = "Brick"; }); IfcPropertyReferenceValue ifcPRValueMaterial = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Material"; prv.PropertyReference = IfcMaterial; }); IfcPropertyReferenceValue ifcPRValuePerson = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Person"; prv.PropertyReference = ifcOwnerHistory.OwningUser.ThePerson; }); IfcDateAndTime ifcDateAndTime = model.Instances.New <IfcDateAndTime>(dt => { dt.DateComponent = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 25; cd.MonthComponent = 3; cd.YearComponent = 2013; }); dt.TimeComponent = model.Instances.New <IfcLocalTime>(lt => { lt.HourComponent = 10; lt.MinuteComponent = 30; lt.SecondComponent = 0; }); }); IfcPropertyReferenceValue ifcPRValueDateTime = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:DateAndTime"; prv.PropertyReference = ifcDateAndTime; }); IfcMaterialList ifcMaterialList = model.Instances.New <IfcMaterialList>(ml => { ml.Materials.Add(IfcMaterial); ml.Materials.Add(model.Instances.New <IfcMaterial>(m => { m.Name = "Cavity"; })); ml.Materials.Add(model.Instances.New <IfcMaterial>(m => { m.Name = "Block"; })); }); IfcPropertyReferenceValue ifcPRValueMatList = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:MaterialList"; prv.PropertyReference = ifcMaterialList; }); IfcPropertyReferenceValue ifcPRValueOrg = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Organization"; prv.PropertyReference = ifcOwnerHistory.OwningUser.TheOrganization; }); IfcPropertyReferenceValue ifcPRValueDate = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Date"; prv.PropertyReference = ifcDateAndTime.DateComponent; }); IfcPropertyReferenceValue ifcPRValueTime = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Time"; prv.PropertyReference = ifcDateAndTime.TimeComponent; }); IfcPropertyReferenceValue ifcPRValuePersonOrg = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:PersonOrganization"; prv.PropertyReference = ifcOwnerHistory.OwningUser; }); IfcMaterialLayer ifcMaterialLayer = model.Instances.New <IfcMaterialLayer>(ml => { ml.Material = IfcMaterial; ml.LayerThickness = 100.0; }); IfcPropertyReferenceValue ifcPRValueMatLayer = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:MaterialLayer"; prv.PropertyReference = ifcMaterialLayer; }); IfcDocumentReference ifcDocumentReference = model.Instances.New <IfcDocumentReference>(dr => { dr.Name = "Document"; dr.Location = "c://Documents//TheDoc.Txt"; }); IfcPropertyReferenceValue ifcPRValueRef = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Document"; prv.PropertyReference = ifcDocumentReference; }); IfcRegularTimeSeries ifcTimeSeries = model.Instances.New <IfcRegularTimeSeries>(ts => { ts.Name = "Regular Time Series"; ts.Description = "Time series of events"; ts.StartTime = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 01; cd.MonthComponent = 1; cd.YearComponent = 2013; }); ts.EndTime = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 01; cd.MonthComponent = 3; cd.YearComponent = 2013; }); ts.TimeSeriesDataType = IfcTimeSeriesDataTypeEnum.CONTINUOUS; ts.DataOrigin = IfcDataOriginEnum.MEASURED; ts.TimeStep = 604800; //7 days in secs }); IfcPropertyReferenceValue ifcPRValueTimeSeries = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:TimeSeries"; prv.PropertyReference = ifcTimeSeries; }); IfcPostalAddress ifcAddress = model.Instances.New <IfcPostalAddress>(a => { a.InternalLocation = "Room 101"; a.SetAddressLines(new string[] { "12 New road", "DoxField" }); a.Town = "Sunderland"; a.PostalCode = "DL01 6SX"; }); IfcPropertyReferenceValue ifcPRValueAddress = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Address"; prv.PropertyReference = ifcAddress; }); IfcTelecomAddress IfcTelecomAddress = model.Instances.New <IfcTelecomAddress>(a => { a.SetTelephoneNumbers(new string[] { "01325 6589965" }); a.SetElectronicMailAddress(new string[] { "*****@*****.**" }); }); IfcPropertyReferenceValue ifcPRValueTelecom = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Telecom"; prv.PropertyReference = IfcTelecomAddress; }); IfcCostValue ifcCostValue = model.Instances.New <IfcCostValue>(cv => { cv.Name = "Cost Value"; cv.Description = ""; cv.Value = new IfcMonetaryMeasure(155.0); cv.ApplicableDate = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 02; cd.MonthComponent = 02; cd.YearComponent = 2013; }); cv.FixedUntilDate = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 31; cd.MonthComponent = 12; cd.YearComponent = 2013; }); cv.CostType = "Annual rate of return"; cv.Condition = ""; }); IfcPropertyReferenceValue ifcPRValueCostValue = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:CostValue"; prv.PropertyReference = ifcCostValue; }); IfcEnvironmentalImpactValue IfcEnvironmentalImpactValue = model.Instances.New <IfcEnvironmentalImpactValue>(cv => { cv.Name = "Environmental Impact"; cv.Description = ""; cv.Value = model.Instances.New <IfcMeasureWithUnit>(mwu => { mwu.ValueComponent = new IfcReal(111.0); mwu.UnitComponent = model.Instances.New <IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.LENGTHUNIT; siu.Name = IfcSIUnitName.METRE; siu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); }); cv.ApplicableDate = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 02; cd.MonthComponent = 02; cd.YearComponent = 2013; }); cv.FixedUntilDate = model.Instances.New <IfcCalendarDate>(cd => { cd.DayComponent = 31; cd.MonthComponent = 12; cd.YearComponent = 2013; }); cv.ImpactType = "Embodied energy"; cv.Category = IfcEnvironmentalImpactCategoryEnum.MANUFACTURE; }); IfcPropertyReferenceValue ifcPRValueEnvironmentalImpact = model.Instances.New <IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:EnvironmentalImpact"; prv.PropertyReference = IfcEnvironmentalImpactValue; }); //lets create the IfcElementQuantity IfcPropertySet ifcPropertySet = model.Instances.New <IfcPropertySet>(ps => { ps.OwnerHistory = ifcOwnerHistory; ps.Name = "Test:IfcPropertySet"; ps.Description = "Property Set"; ps.HasProperties.Add(ifcPropertySingleValue); ps.HasProperties.Add(ifcPropertyEnumeratedValue); ps.HasProperties.Add(ifcPropertyBoundedValue); ps.HasProperties.Add(ifcPropertyTableValue); ps.HasProperties.Add(ifcPropertyListValue); ps.HasProperties.Add(ifcPRValueMaterial); ps.HasProperties.Add(ifcPRValuePerson); ps.HasProperties.Add(ifcPRValueDateTime); ps.HasProperties.Add(ifcPRValueMatList); ps.HasProperties.Add(ifcPRValueOrg); ps.HasProperties.Add(ifcPRValueDate); ps.HasProperties.Add(ifcPRValueTime); ps.HasProperties.Add(ifcPRValuePersonOrg); ps.HasProperties.Add(ifcPRValueMatLayer); ps.HasProperties.Add(ifcPRValueRef); ps.HasProperties.Add(ifcPRValueTimeSeries); ps.HasProperties.Add(ifcPRValueAddress); ps.HasProperties.Add(ifcPRValueTelecom); ps.HasProperties.Add(ifcPRValueCostValue); ps.HasProperties.Add(ifcPRValueEnvironmentalImpact); }); //need to create the relationship IfcRelDefinesByProperties ifcRelDefinesByProperties = model.Instances.New <IfcRelDefinesByProperties>(rdbp => { rdbp.OwnerHistory = ifcOwnerHistory; rdbp.Name = "Property Association"; rdbp.Description = "IfcPropertySet associated to wall"; rdbp.RelatedObjects.Add(wall); rdbp.RelatingPropertyDefinition = ifcPropertySet; }); }
private void CreateSimpleProperty(XbimModel model, IfcWallStandardCase wall, IfcOwnerHistory ifcOwnerHistory) { var ifcPropertySingleValue = model.Instances.New<IfcPropertySingleValue>(psv => { psv.Name = "IfcPropertySingleValue:Time"; psv.Description = ""; psv.NominalValue = new IfcTimeMeasure(150.0); psv.Unit = model.Instances.New<IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.TIMEUNIT; siu.Name = IfcSIUnitName.SECOND; siu.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 0; de.TimeExponent = 1; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); }); var ifcPropertyEnumeratedValue = model.Instances.New<IfcPropertyEnumeratedValue>(pev => { pev.Name = "IfcPropertyEnumeratedValue:Music"; pev.EnumerationReference = model.Instances.New<IfcPropertyEnumeration>(pe => { pe.Name = "Notes"; pe.EnumerationValues.Add(new IfcLabel("Do")); pe.EnumerationValues.Add(new IfcLabel("Re")); pe.EnumerationValues.Add(new IfcLabel("Mi")); pe.EnumerationValues.Add(new IfcLabel("Fa")); pe.EnumerationValues.Add(new IfcLabel("So")); pe.EnumerationValues.Add(new IfcLabel("La")); pe.EnumerationValues.Add(new IfcLabel("Ti")); }); pev.EnumerationValues.Add(new IfcLabel("Do")); pev.EnumerationValues.Add(new IfcLabel("Re")); pev.EnumerationValues.Add(new IfcLabel("Mi")); }); var ifcPropertyBoundedValue = model.Instances.New<IfcPropertyBoundedValue>(pbv => { pbv.Name = "IfcPropertyBoundedValue:Mass"; pbv.Description = ""; pbv.UpperBoundValue = new IfcMassMeasure(5000.0); pbv.LowerBoundValue = new IfcMassMeasure(1000.0); pbv.Unit = model.Instances.New<IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.MASSUNIT; siu.Name = IfcSIUnitName.GRAM; siu.Prefix = IfcSIPrefix.KILO; siu.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 1; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); }); var definingValues = new List<IfcReal> { new IfcReal(100.0), new IfcReal(200.0), new IfcReal(400.0), new IfcReal(800.0), new IfcReal(1600.0), new IfcReal(3200.0), }; var definedValues = new List<IfcReal> { new IfcReal(20.0), new IfcReal(42.0), new IfcReal(46.0), new IfcReal(56.0), new IfcReal(60.0), new IfcReal(65.0), }; var ifcPropertyTableValue = model.Instances.New<IfcPropertyTableValue>(ptv => { ptv.Name = "IfcPropertyTableValue:Sound"; foreach (var item in definingValues) { ptv.DefiningValues.Add(item); } foreach (var item in definedValues) { ptv.DefinedValues.Add(item); } ptv.DefinedUnit = model.Instances.New<IfcContextDependentUnit>(cd => { cd.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 0; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cd.UnitType = IfcUnitEnum.FREQUENCYUNIT; cd.Name = "dB"; }); }); var listValues = new List<IfcLabel> { new IfcLabel("Red"), new IfcLabel("Green"), new IfcLabel("Blue"), new IfcLabel("Pink"), new IfcLabel("White"), new IfcLabel("Black"), }; var ifcPropertyListValue = model.Instances.New<IfcPropertyListValue>(plv => { plv.Name = "IfcPropertyListValue:Colours"; foreach (var item in listValues) { plv.ListValues.Add(item); } }); var ifcMaterial = model.Instances.New<IfcMaterial>(m => { m.Name = "Brick"; }); var ifcPrValueMaterial = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Material"; prv.PropertyReference = ifcMaterial; }); var ifcPrValuePerson = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Person"; prv.PropertyReference = ifcOwnerHistory.OwningUser.ThePerson; }); var ifcDateAndTime = model.Instances.New<IfcDateAndTime>(dt => { dt.DateComponent = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 25; cd.MonthComponent = 3; cd.YearComponent = 2013; }); dt.TimeComponent = model.Instances.New<IfcLocalTime>(lt => { lt.HourComponent = 10; lt.MinuteComponent = 30; lt.SecondComponent = 0; }); }); var ifcPrValueDateTime = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:DateAndTime"; prv.PropertyReference = ifcDateAndTime; }); var ifcMaterialList = model.Instances.New<IfcMaterialList>(ml => { ml.Materials.Add(ifcMaterial); ml.Materials.Add(model.Instances.New<IfcMaterial>(m => { m.Name = "Cavity"; })); ml.Materials.Add(model.Instances.New<IfcMaterial>(m => { m.Name = "Block"; })); }); var ifcPrValueMatList = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:MaterialList"; prv.PropertyReference = ifcMaterialList; }); var ifcPrValueOrg = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Organization"; prv.PropertyReference = ifcOwnerHistory.OwningUser.TheOrganization; }); var ifcPrValueDate = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Date"; prv.PropertyReference = ifcDateAndTime.DateComponent; }); var ifcPrValueTime = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Time"; prv.PropertyReference = ifcDateAndTime.TimeComponent; }); var ifcPrValuePersonOrg = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:PersonOrganization"; prv.PropertyReference = ifcOwnerHistory.OwningUser; }); var ifcMaterialLayer = model.Instances.New<IfcMaterialLayer>(ml => { ml.Material = ifcMaterial; ml.LayerThickness = 100.0; }); var ifcPrValueMatLayer = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:MaterialLayer"; prv.PropertyReference = ifcMaterialLayer; }); var ifcDocumentReference = model.Instances.New<IfcDocumentReference>(dr => { dr.Name = "Document"; dr.Location = "c://Documents//TheDoc.Txt"; }); var ifcPrValueRef = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Document"; prv.PropertyReference = ifcDocumentReference; }); var ifcTimeSeries = model.Instances.New<IfcRegularTimeSeries>(ts => { ts.Name = "Regular Time Series"; ts.Description = "Time series of events"; ts.StartTime = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 01; cd.MonthComponent = 1; cd.YearComponent = 2013; }); ts.EndTime = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 01; cd.MonthComponent = 3; cd.YearComponent = 2013; }); ts.TimeSeriesDataType = IfcTimeSeriesDataTypeEnum.CONTINUOUS; ts.DataOrigin = IfcDataOriginEnum.MEASURED; ts.TimeStep = 604800; //7 days in secs }); var ifcPrValueTimeSeries = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:TimeSeries"; prv.PropertyReference = ifcTimeSeries; }); var ifcAddress = model.Instances.New<IfcPostalAddress>(a => { a.InternalLocation = "Room 101"; a.SetAddressLines(new[] { "12 New road", "DoxField" }); a.Town = "Sunderland"; a.PostalCode = "DL01 6SX"; }); var ifcPrValueAddress = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Address"; prv.PropertyReference = ifcAddress; }); var ifcTelecomAddress = model.Instances.New<IfcTelecomAddress>(a => { a.SetTelephoneNumbers(new[] { "01325 6589965" }); a.SetElectronicMailAddress(new[] { "*****@*****.**" }); }); var ifcPrValueTelecom = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:Telecom"; prv.PropertyReference = ifcTelecomAddress; }); var ifcCostValue = model.Instances.New<IfcCostValue>(cv => { cv.Name = "Cost Value"; cv.Description = ""; cv.Value = new IfcMonetaryMeasure(155.0); cv.ApplicableDate = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 02; cd.MonthComponent = 02; cd.YearComponent = 2013; }); cv.FixedUntilDate = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 31; cd.MonthComponent = 12; cd.YearComponent = 2013; }); cv.CostType = "Annual rate of return"; cv.Condition = ""; }); var ifcPrValueCostValue = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:CostValue"; prv.PropertyReference = ifcCostValue; }); var ifcEnvironmentalImpactValue = model.Instances.New<IfcEnvironmentalImpactValue>(cv => { cv.Name = "Environmental Impact"; cv.Description = ""; cv.Value = model.Instances.New<IfcMeasureWithUnit>(mwu => { mwu.ValueComponent = new IfcReal(111.0); mwu.UnitComponent = model.Instances.New<IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.LENGTHUNIT; siu.Name = IfcSIUnitName.METRE; siu.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); }); cv.ApplicableDate = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 02; cd.MonthComponent = 02; cd.YearComponent = 2013; }); cv.FixedUntilDate = model.Instances.New<IfcCalendarDate>(cd => { cd.DayComponent = 31; cd.MonthComponent = 12; cd.YearComponent = 2013; }); cv.ImpactType = "Embodied energy"; cv.Category = IfcEnvironmentalImpactCategoryEnum.MANUFACTURE; }); var ifcPrValueEnvironmentalImpact = model.Instances.New<IfcPropertyReferenceValue>(prv => { prv.Name = "IfcPropertyReferenceValue:EnvironmentalImpact"; prv.PropertyReference = ifcEnvironmentalImpactValue; }); //lets create the IfcElementQuantity var ifcPropertySet = model.Instances.New<IfcPropertySet>(ps => { ps.OwnerHistory = ifcOwnerHistory; ps.Name = "Test:IfcPropertySet"; ps.Description = "Property Set"; ps.HasProperties.Add(ifcPropertySingleValue); ps.HasProperties.Add(ifcPropertyEnumeratedValue); ps.HasProperties.Add(ifcPropertyBoundedValue); ps.HasProperties.Add(ifcPropertyTableValue); ps.HasProperties.Add(ifcPropertyListValue); ps.HasProperties.Add(ifcPrValueMaterial); ps.HasProperties.Add(ifcPrValuePerson); ps.HasProperties.Add(ifcPrValueDateTime); ps.HasProperties.Add(ifcPrValueMatList); ps.HasProperties.Add(ifcPrValueOrg); ps.HasProperties.Add(ifcPrValueDate); ps.HasProperties.Add(ifcPrValueTime); ps.HasProperties.Add(ifcPrValuePersonOrg); ps.HasProperties.Add(ifcPrValueMatLayer); ps.HasProperties.Add(ifcPrValueRef); ps.HasProperties.Add(ifcPrValueTimeSeries); ps.HasProperties.Add(ifcPrValueAddress); ps.HasProperties.Add(ifcPrValueTelecom); ps.HasProperties.Add(ifcPrValueCostValue); ps.HasProperties.Add(ifcPrValueEnvironmentalImpact); }); //need to create the relationship model.Instances.New<IfcRelDefinesByProperties>(rdbp => { rdbp.OwnerHistory = ifcOwnerHistory; rdbp.Name = "Property Association"; rdbp.Description = "IfcPropertySet associated to wall"; rdbp.RelatedObjects.Add(wall); rdbp.RelatingPropertyDefinition = ifcPropertySet; }); }
private void CreateElementQuantity(XbimModel model, IfcWallStandardCase wall, IfcOwnerHistory ifcOwnerHistory) { //Create a IfcElementQuantity //first we need a IfcPhysicalSimpleQuantity,first will use IfcQuantityArea var ifcQuantityArea = model.Instances.New<IfcQuantityArea>(qa => { qa.Name = "IfcQuantityArea:Area"; qa.Description = ""; qa.Unit = model.Instances.New<IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.AREAUNIT; siu.Prefix = IfcSIPrefix.MILLI; siu.Name = IfcSIUnitName.SQUARE_METRE; siu.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); }); qa.AreaValue = 100.0; }); //next quantity IfcQuantityCount using IfcContextDependentUnit var ifcContextDependentUnit = model.Instances.New<IfcContextDependentUnit>(cd => { cd.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cd.UnitType = IfcUnitEnum.LENGTHUNIT; cd.Name = "Elephants"; }); var ifcQuantityCount = model.Instances.New<IfcQuantityCount>(qc => { qc.Name = "IfcQuantityCount:Elephant"; qc.CountValue = 12; qc.Unit = ifcContextDependentUnit; }); //next quantity IfcQuantityLength using IfcConversionBasedUnit var ifcConversionBasedUnit = model.Instances.New<IfcConversionBasedUnit>(cbu => { cbu.ConversionFactor = model.Instances.New<IfcMeasureWithUnit>(mu => { mu.ValueComponent = new IfcRatioMeasure(25.4); mu.UnitComponent = model.Instances.New<IfcSIUnit>(siu => { siu.UnitType = IfcUnitEnum.LENGTHUNIT; siu.Prefix = IfcSIPrefix.MILLI; siu.Name = IfcSIUnitName.METRE; }); }); cbu.Dimensions = model.Instances.New<IfcDimensionalExponents>(de => { de.LengthExponent = 1; de.MassExponent = 0; de.TimeExponent = 0; de.ElectricCurrentExponent = 0; de.ThermodynamicTemperatureExponent = 0; de.AmountOfSubstanceExponent = 0; de.LuminousIntensityExponent = 0; }); cbu.UnitType = IfcUnitEnum.LENGTHUNIT; cbu.Name = "Inch"; }); var ifcQuantityLength = model.Instances.New<IfcQuantityLength>(qa => { qa.Name = "IfcQuantityLength:Length"; qa.Description = ""; qa.Unit = ifcConversionBasedUnit; qa.LengthValue = 24.0; }); //lets create the IfcElementQuantity var ifcElementQuantity = model.Instances.New<IfcElementQuantity>(eq => { eq.OwnerHistory = ifcOwnerHistory; eq.Name = "Test:IfcElementQuantity"; eq.Description = "Measurement quantity"; eq.Quantities.Add(ifcQuantityArea); eq.Quantities.Add(ifcQuantityCount); eq.Quantities.Add(ifcQuantityLength); }); //need to create the relationship model.Instances.New<IfcRelDefinesByProperties>(rdbp => { rdbp.OwnerHistory = ifcOwnerHistory; rdbp.Name = "Area Association"; rdbp.Description = "IfcElementQuantity associated to wall"; rdbp.RelatedObjects.Add(wall); rdbp.RelatingPropertyDefinition = ifcElementQuantity; }); }
/// <summary> /// Add some properties to the wall, /// </summary> /// <param name="model">XbimModel</param> /// <param name="wall"></param> private void AddPropertiesToWall(XbimModel model, IfcWallStandardCase wall) { using (XbimReadWriteTransaction txn = model.BeginTransaction("Create Wall")) { IfcOwnerHistory ifcOwnerHistory = model.IfcProject.OwnerHistory; //we just use the project owner history for the properties, saves creating one CreateElementQuantity(model, wall, ifcOwnerHistory); CreateSimpleProperty(model, wall, ifcOwnerHistory); //if (model.Validate(txn.Modified(), Console.Out) == 0) //{ txn.Commit(); //} } }
/// <summary> /// This creates a wall and it's geometry, many geometric representations are possible and extruded rectangular footprint is chosen as this is commonly used for standard case walls /// </summary> /// <param name="model"></param> /// <param name="length">Length of the rectangular footprint</param> /// <param name="width">Width of the rectangular footprint (width of the wall)</param> /// <param name="height">Height to extrude the wall, extrusion is vertical</param> /// <returns></returns> private IfcWallStandardCase CreateWall(XbimModel model, double length, double width, double height) { // //begin a transaction using (XbimReadWriteTransaction txn = model.BeginTransaction("Create Wall")) { IfcWallStandardCase wall = model.Instances.New <IfcWallStandardCase>(); wall.Name = "A Standard rectangular wall"; // required parameters for IfcWall wall.OwnerHistory.OwningUser = model.DefaultOwningUser; wall.OwnerHistory.OwningApplication = model.DefaultOwningApplication; //represent wall as a rectangular profile IfcRectangleProfileDef rectProf = model.Instances.New <IfcRectangleProfileDef>(); rectProf.ProfileType = IfcProfileTypeEnum.AREA; rectProf.XDim = width; rectProf.YDim = length; IfcCartesianPoint insertPoint = model.Instances.New <IfcCartesianPoint>(); insertPoint.SetXY(0, 400); //insert at arbitrary position rectProf.Position = model.Instances.New <IfcAxis2Placement2D>(); rectProf.Position.Location = insertPoint; //model as a swept area solid IfcExtrudedAreaSolid body = model.Instances.New <IfcExtrudedAreaSolid>(); body.Depth = height; body.SweptArea = rectProf; body.ExtrudedDirection = model.Instances.New <IfcDirection>(); body.ExtrudedDirection.SetXYZ(0, 0, 1); //parameters to insert the geometry in the model IfcCartesianPoint origin = model.Instances.New <IfcCartesianPoint>(); origin.SetXYZ(0, 0, 0); body.Position = model.Instances.New <IfcAxis2Placement3D>(); body.Position.Location = origin; //Create a Definition shape to hold the geometry IfcShapeRepresentation shape = model.Instances.New <IfcShapeRepresentation>(); shape.ContextOfItems = model.IfcProject.ModelContext(); shape.RepresentationType = "SweptSolid"; shape.RepresentationIdentifier = "Body"; shape.Items.Add_Reversible(body); //Create a Product Definition and add the model geometry to the wall IfcProductDefinitionShape rep = model.Instances.New <IfcProductDefinitionShape>(); rep.Representations.Add_Reversible(shape); wall.Representation = rep; //now place the wall into the model IfcLocalPlacement lp = model.Instances.New <IfcLocalPlacement>(); IfcAxis2Placement3D ax3d = model.Instances.New <IfcAxis2Placement3D>(); ax3d.Location = origin; ax3d.RefDirection = model.Instances.New <IfcDirection>(); ax3d.RefDirection.SetXYZ(0, 1, 0); ax3d.Axis = model.Instances.New <IfcDirection>(); ax3d.Axis.SetXYZ(0, 0, 1); lp.RelativePlacement = ax3d; wall.ObjectPlacement = lp; // Where Clause: The IfcWallStandard relies on the provision of an IfcMaterialLayerSetUsage IfcMaterialLayerSetUsage ifcMaterialLayerSetUsage = model.Instances.New <IfcMaterialLayerSetUsage>(); IfcMaterialLayerSet ifcMaterialLayerSet = model.Instances.New <IfcMaterialLayerSet>(); IfcMaterialLayer ifcMaterialLayer = model.Instances.New <IfcMaterialLayer>(); ifcMaterialLayer.LayerThickness = 10; ifcMaterialLayerSet.MaterialLayers.Add_Reversible(ifcMaterialLayer); ifcMaterialLayerSetUsage.ForLayerSet = ifcMaterialLayerSet; ifcMaterialLayerSetUsage.LayerSetDirection = IfcLayerSetDirectionEnum.AXIS2; ifcMaterialLayerSetUsage.DirectionSense = IfcDirectionSenseEnum.NEGATIVE; ifcMaterialLayerSetUsage.OffsetFromReferenceLine = 150; // Add material to wall IfcMaterial material = model.Instances.New <IfcMaterial>(); material.Name = "some material"; IfcRelAssociatesMaterial ifcRelAssociatesMaterial = model.Instances.New <IfcRelAssociatesMaterial>(); ifcRelAssociatesMaterial.RelatingMaterial = material; ifcRelAssociatesMaterial.RelatedObjects.Add_Reversible(wall); ifcRelAssociatesMaterial.RelatingMaterial = ifcMaterialLayerSetUsage; // IfcPresentationLayerAssignment is required for CAD presentation in IfcWall or IfcWallStandardCase IfcPresentationLayerAssignment ifcPresentationLayerAssignment = model.Instances.New <IfcPresentationLayerAssignment>(); ifcPresentationLayerAssignment.Name = "some ifcPresentationLayerAssignment"; ifcPresentationLayerAssignment.AssignedItems.Add(shape); // linear segment as IfcPolyline with two points is required for IfcWall IfcPolyline ifcPolyline = model.Instances.New <IfcPolyline>(); IfcCartesianPoint startPoint = model.Instances.New <IfcCartesianPoint>(); startPoint.SetXY(0, 0); IfcCartesianPoint endPoint = model.Instances.New <IfcCartesianPoint>(); endPoint.SetXY(4000, 0); ifcPolyline.Points.Add_Reversible(startPoint); ifcPolyline.Points.Add_Reversible(endPoint); IfcShapeRepresentation shape2d = model.Instances.New <IfcShapeRepresentation>(); shape2d.ContextOfItems = model.IfcProject.ModelContext(); shape2d.RepresentationIdentifier = "Axis"; shape2d.RepresentationType = "Curve2D"; shape2d.Items.Add_Reversible(ifcPolyline); rep.Representations.Add_Reversible(shape2d); //validate write any errors to the console and commit if ok, otherwise abort if (model.Validate(txn.Modified(), Console.Out) == 0) { txn.Commit(); return(wall); } } return(null); }
public XbimCreateBuilding(Building cadBuilding, string pathToSave) { using (var model = CreateandInitModel("Demo1")) { List <IFloor> lstSortedFloors = cadBuilding.Floors.OrderByDescending(f => f.Level).ToList(); if (model != null) { IfcBuilding building = CreateBuilding(model, "Default Building"); for (int i = 0; i < lstSortedFloors.Count; i++) { Floor floor = lstSortedFloors[i] as Floor; if (floor != null) { if (i + 1 == lstSortedFloors.Count) { break; } double lvlDifference = lstSortedFloors[i].Level - lstSortedFloors[i + 1].Level; double wallHeight = lvlDifference - floor.Slabs[0].Thickness; foreach (Wall cadWall in floor.Walls) { IfcWallStandardCase wall = CreateIfcWall(model, cadWall, wallHeight); if (wall != null) { AddPropertiesToWall(model, wall); } using (var txn = model.BeginTransaction("Add Wall")) { building.AddElement(wall); txn.Commit(); } } foreach (RectColumn cadCol in floor.Columns) { IfcColumn column = CreateIfcColumn(model, cadCol, lvlDifference); using (var txn = model.BeginTransaction("Add column")) { building.AddElement(column); txn.Commit(); } } foreach (Slab cadSlab in floor.Slabs) { slab = CreateIfcSlab(model, cadSlab); using (var trans = model.BeginTransaction("Add Slab")) { building.AddElement(slab); trans.Commit(); } } IfcOpeningElement opening = null; foreach (var cadOpening in floor.Openings) { opening = CreateIfcOpening(model, cadOpening, floor.Slabs[0].Thickness); using (var trans = model.BeginTransaction("Add Opening")) { building.AddElement(opening); //attach opening slab.AttchOpening(model, opening); trans.Commit(); } } //Create stairs foreach (Stair cadStair in floor.Stairs) { IfcStair stair = CreateIfcStair(model, cadStair); using (var txn = model.BeginTransaction("Add Stair")) { building.AddElement(stair); txn.Commit(); } } foreach (LinearPath cadLanding in floor.Landings) { IfcSlab landing = CreateIfcLanding(model, cadLanding, DefaultValues.SlabThinkess); using (var txn = model.BeginTransaction("Add Landing")) { building.AddElement(landing); txn.Commit(); } } } else { Foundation foundation = lstSortedFloors[i] as Foundation; foreach (PCRectFooting cadFooting in foundation.PCFooting) { IfcFooting footing = CreateIfcFooting(model, cadFooting); using (var txn = model.BeginTransaction("Add Footing")) { building.AddElement(footing); txn.Commit(); } } foreach (RCRectFooting cadFooting in foundation.RCFooting) { IfcFooting footing = CreateIfcFooting(model, cadFooting); using (var txn = model.BeginTransaction("Add Footing")) { building.AddElement(footing); txn.Commit(); } } foreach (SlopedSlab cadRamp in foundation.Ramps) { IfcSlab ramp = CreateIfcSlopedSlab(model, cadRamp); using (var txn = model.BeginTransaction("Add Ramp")) { building.AddElement(ramp); txn.Commit(); } } } } try { Console.WriteLine("Standard Wall successfully created...."); //write the Ifc File model.SaveAs(pathToSave + @"\Demo1.ifc", IfcStorageType.Ifc); Console.WriteLine("WallIfc4.ifc has been successfully written"); } catch (Exception e) { Console.WriteLine("Failed to save!"); Console.WriteLine(e.Message); } } } }
/// <summary> /// This creates a wall and it's geometry, many geometric representations are possible and extruded rectangular footprint is chosen as this is commonly used for standard case walls /// </summary> /// <param name="model"></param> /// <param name="length">Length of the rectangular footprint</param> /// <param name="width">Width of the rectangular footprint (width of the wall)</param> /// <param name="height">Height to extrude the wall, extrusion is vertical</param> /// <returns></returns> private IfcWallStandardCase CreateIfcWall(IfcStore model, Wall cadWall, double height) { //cadWall.Thickness *= 1000; //cadWall.StPt.X *= 1000; //cadWall.StPt.Y*= 1000; //cadWall.EndPt.X *= 1000; //cadWall.EndPt.Y *= 1000; //dimensions of the new IFC Wall we want to create double length = Math.Abs(cadWall.EndPt.X - cadWall.StPt.X) > 0 ? Math.Abs(cadWall.EndPt.X - cadWall.StPt.X) : Math.Abs(cadWall.EndPt.Y - cadWall.StPt.Y); double width = cadWall.Thickness; //begin a transaction using (var trans = model.BeginTransaction("Create Wall")) { IfcWallStandardCase wallToCreate = model.Instances.New <IfcWallStandardCase>(); wallToCreate.Name = " Wall - Wall:UC305x305x97:" + random.Next(1000, 10000); //represent wall as a rectangular profile IfcRectangleProfileDef rectProf = IFCHelper.RectProfileCreate(model, length, width); //Profile Insertion Point rectProf.ProfileInsertionPointSet(model, 0, 0); //model as a swept area solid IfcDirection extrusionDir = model.Instances.New <IfcDirection>(); extrusionDir.SetXYZ(0, 0, -1); IfcExtrudedAreaSolid body = IFCHelper.ProfileSweptSolidCreate(model, height, rectProf, extrusionDir); //parameters to insert the geometry in the model body.BodyPlacementSet(model, 0, 0, 0); //Create a Definition shape to hold the geometry of the wall 3D body IfcShapeRepresentation shape = IFCHelper.ShapeRepresentationCreate(model, "SweptSolid", "Body"); shape.Items.Add(body); //Create a Product Definition and add the model geometry to the wall IfcProductDefinitionShape prDefShape = model.Instances.New <IfcProductDefinitionShape>(); prDefShape.Representations.Add(shape); wallToCreate.Representation = prDefShape; //Create Local axes system and assign it to the wall var midPt = MathHelper.MidPoint3D(cadWall.StPt, cadWall.EndPt); IfcCartesianPoint location3D = model.Instances.New <IfcCartesianPoint>(); location3D.SetXYZ(midPt.X, midPt.Y, midPt.Z); var uvWallLongDir = MathHelper.UnitVectorFromPt1ToPt2(cadWall.StPt, cadWall.EndPt); IfcDirection localXDir = model.Instances.New <IfcDirection>(); localXDir.SetXYZ(uvWallLongDir.X, uvWallLongDir.Y, uvWallLongDir.Z); IfcDirection localZDir = model.Instances.New <IfcDirection>(); localZDir.SetXYZ(0, 0, 1); IfcAxis2Placement3D ax3D = IFCHelper.LocalAxesSystemCreate(model, location3D, localXDir, localZDir); //now place the wall into the model IfcLocalPlacement lp = IFCHelper.LocalPlacemetCreate(model, ax3D); wallToCreate.ObjectPlacement = lp; // IfcPresentationLayerAssignment is required for CAD presentation in IfcWall or IfcWallStandardCase var ifcPresentationLayerAssignment = model.Instances.New <IfcPresentationLayerAssignment>(); ifcPresentationLayerAssignment.Name = "some ifcPresentationLayerAssignment"; ifcPresentationLayerAssignment.AssignedItems.Add(shape); trans.Commit(); return(wallToCreate); } }