コード例 #1
0
ファイル: COBieXBimType.cs プロジェクト: tnesser/XbimExchange
        /// <summary>
        /// Add the data to the Material object
        /// </summary>
        /// <param name="row">COBieTypeRow holding the data</param>

        private void AddMaterial(COBieTypeRow row)
        {
            if (ValidateString(row.Name))
            {
                IfcMaterial ifcMaterial = null;
                //we will skip over the IfcMaterialLayerSets and allow the assembly sheet to create them
                if ((row.ExtObject.ToLower() == "ifcmaterial") ||
                    (row.ExtObject.ToLower() == "ifcmateriallayer")
                    )
                {
                    string name = GetMaterialName(row.Name);
                    ifcMaterial = Model.Instances.Where <IfcMaterial>(m => m.Name.ToString().ToLower() == name.ToLower()).FirstOrDefault();
                    if (ifcMaterial == null)
                    {
                        ifcMaterial = Model.Instances.New <IfcMaterial>(m => { m.Name = name; });
                    }
                }
                if ((ifcMaterial != null) && (row.ExtObject.ToLower() == "ifcmateriallayer"))
                {
                    IfcMaterialLayer ifcMaterialLayer = null;
                    double           matThick         = 0.0;
                    if ((ValidateString(row.NominalWidth)) &&
                        (!double.TryParse(row.NominalWidth, out matThick))
                        )
                    {
                        matThick = 0.0;
                    }
                    ifcMaterialLayer = Model.Instances.Where <IfcMaterialLayer>(ml => ml.Material == ifcMaterial && ml.LayerThickness == matThick).FirstOrDefault();
                    if (ifcMaterialLayer == null)
                    {
                        ifcMaterialLayer = Model.Instances.New <IfcMaterialLayer>(ml => { ml.Material = ifcMaterial; ml.LayerThickness = matThick; });
                    }
                }
            }
        }
コード例 #2
0
ファイル: Slab.cs プロジェクト: tsiddikee/IfcScript
        internal static void GenerateData(STPModelData md, IfcBuilding building, bool openings)
        {
            IfcMaterial         concrete         = new IfcMaterial(md, "Concrete", "", "");
            int                 thickness        = 200;
            IfcMaterialLayer    materialLayer    = new IfcMaterialLayer(md, concrete, thickness, false, "Core", "", "", 0);
            string              name             = thickness + "mm Concrete";
            IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(md, materialLayer, name, "");

            materialLayerSet.Associates.GlobalId = "2l_enLhI93reVwnim9gXUq";
            md.NextObjectRecord = 300;
            IfcSlabType slabType = new IfcSlabType(md, new IfcElemTypeParams("0RSW$KKbzCZ9QaSm3GoEan", name, "", "", ""), materialLayerSet, null, IfcSlabTypeEnum.FLOOR);

            slabType.ObjectTypeOf.GlobalId = "3wwDcmW5T3HfafURQewdD0";
            PolyCurve polycurve = new PolyCurve();

            polycurve.Append(new Line(0, 0, 0, 1000, 0, 0));
            polycurve.Append(new Arc(new Point3d(1000, 0, 0), new Point3d(1400, 2000, 0), new Point3d(1000, 4000, 0)));
            polycurve.Append(new Line(1000, 4000, 0, 0, 4000, 0));
            polycurve.Append(new Arc(new Point3d(0, 4000, 0), new Point3d(-400, 2000, 0), new Point3d(0, 0, 0)));
            IfcSlabStandardCase slabStandardCase = new IfcSlabStandardCase(building, new IfcElemParams("1wAj$J2Az2V8wnBiVYd3bU", "", "", "", ""), slabType, polycurve, -200, true, null);

            slabStandardCase.Material.Associates.GlobalId = "3ESAzibgr9BvK9M75iV84w";
            if (openings)
            {
                IfcCircleProfileDef    cpd     = new IfcCircleProfileDef(md, IfcProfileTypeEnum.AREA, "100DIA", null, 50);
                IfcExtrudedAreaSolid   eas     = new IfcExtrudedAreaSolid(cpd, new IfcAxis2Placement3D(md, new Plane(new Point3d(100, 300, -200), Vector3d.XAxis, Vector3d.YAxis)), new IfcDirection(md, 0, 0, 1), thickness);
                IfcOpeningStandardCase opening = new IfcOpeningStandardCase(slabStandardCase, new IfcElemParams("15RSTHd8nFVQWMRE7og7sd", "Opening", "", "", ""), null, eas);
                opening.VoidsElement.GlobalId = "0gqEDsyEzFXvY$fc_rUxyO";
                IfcRectangleProfileDef rpd = new IfcRectangleProfileDef(md, IfcProfileTypeEnum.AREA, "RecessRectangle", null, 500, 1000);
                eas = new IfcExtrudedAreaSolid(rpd, new IfcAxis2Placement3D(md, new Plane(new Point3d(500, 1000, -50), Vector3d.XAxis, Vector3d.YAxis)), new IfcDirection(md, 0, 0, 1), 50);
                IfcOpeningElement recess = new IfcOpeningElement(slabStandardCase, new IfcElemParams("0w93HZ19H2D99zbAVNb4o2", "Recess", "", "", ""), eas, IfcOpeningElementTypeEnum.RECESS);
                recess.VoidsElement.GlobalId = "3iUkij4q1DmxlXuHzQVJaM";
            }
        }
コード例 #3
0
        private bool IsContinuedMaterialRow(COBieAssemblyRow row)
        {
            if (ValidateString(row.Name))
            {
                if (row.Name.Contains(" : continued "))//our flag for a continued assembly child list
                {
                    return(true);
                }

                if (ValidateString(row.ChildNames))
                {
                    string name     = row.Name.ToLower().Trim();
                    string lastname = LastRow.Name.ToLower().Trim();
                    lastname = RemPostFixNumber(lastname);

                    if (name.Contains(lastname))
                    {
                        //test to see if ChildName row as a whole text finds a material, if so then a sing material on the row, so assume the material layer set is listed per row, and not in the ChildName field as a delimited string
                        string           test             = row.ChildNames.ToLower().Trim();
                        IfcMaterialLayer ifcMaterialLayer = IfcMaterialLayers.Where(ml => (ml.Material.Name != null) && (ml.Material.Name.ToString().ToLower().Trim() == test)).FirstOrDefault();
                        if (ifcMaterialLayer != null)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
コード例 #4
0
ファイル: Wall.cs プロジェクト: mccune/IfcScript
        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";
        }
コード例 #5
0
ファイル: Wall.cs プロジェクト: youshengCode/IfcScript
        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";
        }
コード例 #6
0
        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);

            db.NextObjectRecord = 300;
            IfcWallType wallType = new IfcWallType(name, materialLayerSet, IfcWallTypeEnum.NOTDEFINED)
            {
            };
            // todo implement rhinocommon overload IfcWallStandardCase wallStandardCase = new IfcWallStandardCase(building, wallType, new Line(0, 0, 0, 5000, 0, 0), 2000, 0, true, null) {  };
        }
コード例 #7
0
ファイル: Slab.cs プロジェクト: mccune/IfcScript
		internal static void GenerateData(STPModelData md, IfcBuilding building,bool openings)
		{
			IfcMaterial concrete = new IfcMaterial(md, "Concrete", "", "");
			int thickness = 200;
			IfcMaterialLayer materialLayer = new IfcMaterialLayer(md, concrete, thickness, false, "Core", "", "", 0);
			string name = thickness + "mm Concrete";
			IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet( materialLayer, name, "");
			materialLayerSet.Associates.GlobalId = "2l_enLhI93reVwnim9gXUq";
			md.NextObjectRecord = 300;
			IfcSlabType slabType = new IfcSlabType(name, materialLayerSet, IfcSlabTypeEnum.FLOOR) { GlobalId = "0RSW$KKbzCZ9QaSm3GoEan" };
			slabType.ObjectTypeOf.GlobalId = "3wwDcmW5T3HfafURQewdD0";
			PolyCurve polycurve = new PolyCurve();
			polycurve.Append(new Line(0, 0, 0, 1000, 0, 0));
			polycurve.Append(new Arc(new Point3d(1000, 0, 0), new Point3d(1400, 2000, 0), new Point3d(1000, 4000, 0)));
			polycurve.Append(new Line(1000, 4000, 0, 0, 4000, 0));
			polycurve.Append(new Arc(new Point3d(0, 4000, 0), new Point3d(-400, 2000, 0), new Point3d(0, 0, 0)));
			IfcSlabStandardCase slabStandardCase = new IfcSlabStandardCase(building, slabType, polycurve, -200, true, null) { GlobalId = "1wAj$J2Az2V8wnBiVYd3bU" };
			slabStandardCase.Material.Associates.GlobalId = "3ESAzibgr9BvK9M75iV84w";
			if (openings)
			{
				IfcCircleProfileDef cpd = new IfcCircleProfileDef(md, "100DIA", 50);
				IfcExtrudedAreaSolid eas = new IfcExtrudedAreaSolid(cpd,new IfcAxis2Placement3D(md,new Plane(new Point3d(100,300,-200),Vector3d.XAxis,Vector3d.YAxis)),new IfcDirection(md,0,0,1),thickness);
				IfcOpeningStandardCase opening = new IfcOpeningStandardCase(slabStandardCase, null, eas) { GlobalId = "15RSTHd8nFVQWMRE7og7sd", Name = "Opening" };
				opening.VoidsElement.GlobalId = "0gqEDsyEzFXvY$fc_rUxyO";
				IfcRectangleProfileDef rpd = new IfcRectangleProfileDef(md, "RecessRectangle", 500, 1000);
				eas = new IfcExtrudedAreaSolid(rpd, new IfcAxis2Placement3D(md, new Plane(new Point3d(500, 1000, -50), Vector3d.XAxis, Vector3d.YAxis)), new IfcDirection(md, 0, 0, 1), 50);
				IfcOpeningElement recess = new IfcOpeningElement(slabStandardCase, eas, IfcOpeningElementTypeEnum.RECESS) { GlobalId = "0w93HZ19H2D99zbAVNb4o2", Name = "Recess" };
				recess.VoidsElement.GlobalId = "3iUkij4q1DmxlXuHzQVJaM";
			}
		}
コード例 #8
0
        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)
            {
            };
        }
コード例 #9
0
ファイル: Wall.cs プロジェクト: mccune/IfcScript
		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";
		}
コード例 #10
0
        /// <summary>
        /// Add the child objects to the IfcMaterialLayerSet
        /// </summary>
        /// <param name="ifcMaterialLayerSet">IfcMaterialLayerSet object</param>
        /// <param name="childNames">list of child object names separated by " : ", NOT case sensitive</param>
        private bool AddChildObjects(IfcMaterialLayerSet ifcMaterialLayerSet, string childNames)
        {
            bool          returnValue     = false;
            List <string> splitChildNames = SplitString(childNames, ':');

            foreach (string item in splitChildNames)
            {
                string name      = item;
                double?thickness = GetLayerThickness(name);
                name = GetMaterialName(name).ToLower().Trim();
                IfcMaterialLayer ifcMaterialLayer = null;

                IEnumerable <IfcMaterialLayer> ifcMaterialLayers = IfcMaterialLayers.Where(ml => (ml.Material.Name != null) && (ml.Material.Name.ToString().ToLower().Trim() == name));
                if ((ifcMaterialLayers.Any()) &&
                    (ifcMaterialLayers.Count() > 1) &&
                    (thickness != null)
                    )
                {
                    ifcMaterialLayer = ifcMaterialLayers.Where(ml => ml.LayerThickness == thickness).FirstOrDefault();
                }
                else
                {
                    ifcMaterialLayer = ifcMaterialLayers.FirstOrDefault();
                }

                if (ifcMaterialLayer != null)
                {
                    if (!ifcMaterialLayerSet.MaterialLayers.Contains(ifcMaterialLayer))
                    {
                        ifcMaterialLayerSet.MaterialLayers.Add(ifcMaterialLayer);
                    }
                    returnValue = true;
                }
            }
            return(returnValue);
        }
コード例 #11
0
        public static string GetValuesAsString(this IfcObjectReferenceSelect ifcObjectReferenceSelect)
        {
            if (ifcObjectReferenceSelect is IfcMaterial)
            {
                return((ifcObjectReferenceSelect as IfcMaterial).Name.ToString());
            }
            if (ifcObjectReferenceSelect is IfcPerson)
            {
                return((ifcObjectReferenceSelect as IfcPerson).GetFullName());
            }
            if (ifcObjectReferenceSelect is IfcDateAndTime)
            {
                return((ifcObjectReferenceSelect as IfcDateAndTime).GetAsString());
            }
            if (ifcObjectReferenceSelect is IfcMaterialList)
            {
                List <string> values = new List <string>();
                foreach (var item in (ifcObjectReferenceSelect as IfcMaterialList).Materials)
                {
                    values.Add(item.Name.ToString());
                }
                if (values.Count > 0)
                {
                    return(string.Join(", ", values));
                }
                else
                {
                    return(string.Empty);
                }
            }
            if (ifcObjectReferenceSelect is IfcOrganization)
            {
                return((ifcObjectReferenceSelect as IfcOrganization).Name.ToString());
            }
            if (ifcObjectReferenceSelect is IfcCalendarDate)
            {
                return((ifcObjectReferenceSelect as IfcCalendarDate).GetAsString());
            }
            if (ifcObjectReferenceSelect is IfcLocalTime)
            {
                return((ifcObjectReferenceSelect as IfcLocalTime).GetAsString());
            }
            if (ifcObjectReferenceSelect is IfcPersonAndOrganization)
            {
                IfcPersonAndOrganization ifcPersonAndOrganization = (ifcObjectReferenceSelect as IfcPersonAndOrganization);
                string value = ifcPersonAndOrganization.ThePerson.GetFullName();
                value  = value.Trim();
                value += ", " + ifcPersonAndOrganization.TheOrganization.Name.ToString();
                return(value);
            }
            if (ifcObjectReferenceSelect is IfcMaterialLayer)
            {
                IfcMaterialLayer ifcMaterialLayer = (ifcObjectReferenceSelect as IfcMaterialLayer);
                string           value            = string.Empty;
                if (ifcMaterialLayer.Material != null)
                {
                    value += ifcMaterialLayer.Material.Name.ToString();
                }
                if (string.IsNullOrEmpty(value))
                {
                    value = ifcMaterialLayer.LayerThickness.Value.ToString();
                }
                else
                {
                    value += "(" + ifcMaterialLayer.LayerThickness.Value.ToString() + ")";
                }
                return(value);
            }
            if (ifcObjectReferenceSelect is IfcExternalReference)
            {
                IfcExternalReference ifcExternalReference = (ifcObjectReferenceSelect as IfcExternalReference);
                if (ifcExternalReference.Location.HasValue)
                {
                    return(ifcExternalReference.Location.ToString());
                }
                return(string.Empty);
            }
            if (ifcObjectReferenceSelect is IfcTimeSeries)
            {
                return((ifcObjectReferenceSelect as IfcTimeSeries).GetAsString());
            }
            if (ifcObjectReferenceSelect is IfcAddress)
            {
                return((ifcObjectReferenceSelect as IfcAddress).GetAsString());
            }
            if (ifcObjectReferenceSelect is IfcAppliedValue)
            {
                return((ifcObjectReferenceSelect as IfcAppliedValue).GetAsString());
            }

            return(string.Empty);
        }
コード例 #12
0
ファイル: Slab.cs プロジェクト: youshengCode/IfcScript
        internal static void GenerateInstance(IfcBuilding building, bool openings)
        {
            DatabaseIfc db       = building.Database;
            IfcMaterial concrete = new IfcMaterial(db, "Concrete")
            {
                Category = "Concrete"
            };
            int thickness = 200;
            IfcMaterialLayer    materialLayer    = new IfcMaterialLayer(concrete, thickness, "Core");
            string              name             = thickness + "mm Concrete";
            IfcMaterialLayerSet materialLayerSet = new IfcMaterialLayerSet(materialLayer, name);

            db.NextObjectRecord = 300;
            IfcSlabType slabType = new IfcSlabType(name, materialLayerSet, IfcSlabTypeEnum.FLOOR);

            db.Context.AddDeclared(slabType);
            List <Coord2d> points = new List <Coord2d>()
            {
                new Coord2d(0, 0), new Coord2d(1000, 0), new Coord2d(1400, 2000), new Coord2d(1000, 4000), new Coord2d(0, 4000), new Coord2d(-400, 2000)
            };

            List <IfcSegmentIndexSelect> segments = new List <IfcSegmentIndexSelect>();

            segments.Add(new IfcLineIndex(1, 2));
            segments.Add(new IfcArcIndex(2, 3, 4));
            segments.Add(new IfcLineIndex(4, 5));
            segments.Add(new IfcArcIndex(5, 6, 1));
            IfcBoundedCurve          boundedCurve  = IfcBoundedCurve.Generate(db, points, segments);
            IfcMaterialLayerSetUsage layerSetUsage = new IfcMaterialLayerSetUsage(materialLayerSet, IfcLayerSetDirectionEnum.AXIS3, IfcDirectionSenseEnum.NEGATIVE, 0);
            IfcSlab slabStandardCase = new IfcSlabStandardCase(building, layerSetUsage, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), new IfcArbitraryClosedProfileDef("Slab Perimeter", boundedCurve))
            {
                RelatingType = slabType
            };

            slabStandardCase.RelatingType = slabType;
            if (openings)
            {
                IfcCircleProfileDef    cpd     = new IfcCircleProfileDef(db, "100DIA", 50);
                IfcExtrudedAreaSolid   eas     = new IfcExtrudedAreaSolid(cpd, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 100, 300, -200)), new IfcDirection(db, 0, 0, 1), thickness);
                IfcOpeningStandardCase opening = new IfcOpeningStandardCase(slabStandardCase, null, eas)
                {
                    Name = "Opening"
                };
                IfcRectangleProfileDef rpd = new IfcRectangleProfileDef(db, "RecessRectangle", 500, 1000);
                eas = new IfcExtrudedAreaSolid(rpd, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 500, 1000, -50)), new IfcDirection(db, 0, 0, 1), 50);
                IfcOpeningElement recess = new IfcOpeningElement(slabStandardCase, null, new IfcProductDefinitionShape(new IfcShapeRepresentation(eas)))
                {
                    Name = "Recess", PredefinedType = IfcOpeningElementTypeEnum.RECESS
                };

                //Unique ids assigned to generate constant IfcScript  sample files, remove otherwise
                opening.GlobalId = "15RSTHd8nFVQWMRE7og7sd";
                opening.VoidsElement.GlobalId = "0gqEDsyEzFXvY$fc_rUxyO";
                recess.GlobalId = "0w93HZ19H2D99zbAVNb4o2";
                recess.VoidsElement.GlobalId = "3iUkij4q1DmxlXuHzQVJaM";
            }

            //Unique ids assigned to generate constant IfcScript  sample files, remove otherwise
            slabType.GlobalId                    = "0RSW$KKbzCZ9QaSm3GoEan";
            slabStandardCase.GlobalId            = "1wAj$J2Az2V8wnBiVYd3bU";
            materialLayerSet.Associates.GlobalId = "2l_enLhI93reVwnim9gXUq";
            slabType.ObjectTypeOf.GlobalId       = "3wwDcmW5T3HfafURQewdD0";
            slabStandardCase.MaterialSelect.Associates.GlobalId = "3ESAzibgr9BvK9M75iV84w";
        }
コード例 #13
0
        public static string GetValuesAsString(this IfcObjectReferenceSelect ifcObjectReferenceSelect)
        {
            var material = ifcObjectReferenceSelect as IfcMaterial;

            if (material != null)
            {
                return(material.Name.ToString());
            }
            var person = ifcObjectReferenceSelect as IfcPerson;

            if (person != null)
            {
                return(person.GetFullName());
            }
            var time = ifcObjectReferenceSelect as IfcDateAndTime;

            if (time != null)
            {
                return(time.AsString());
            }

            var list = ifcObjectReferenceSelect as IfcMaterialList;

            if (list != null)
            {
                List <string> values = list.Materials.Select(item => item.Name.ToString()).ToList();
                return(values.Count > 0 ? string.Join(", ", values) : string.Empty);
            }
            var @select = ifcObjectReferenceSelect as IfcOrganization;

            if (@select != null)
            {
                return(@select.Name.ToString());
            }
            var date = ifcObjectReferenceSelect as IfcCalendarDate;

            if (date != null)
            {
                return(date.AsString());
            }
            var localTime = ifcObjectReferenceSelect as IfcLocalTime;

            if (localTime != null)
            {
                return(localTime.AsString());
            }
            var organization = ifcObjectReferenceSelect as IfcPersonAndOrganization;

            if (organization != null)
            {
                IfcPersonAndOrganization ifcPersonAndOrganization = organization;
                string value = ifcPersonAndOrganization.ThePerson.GetFullName();
                value  = value.Trim();
                value += ", " + ifcPersonAndOrganization.TheOrganization.Name.ToString();
                return(value);
            }
            var layer = ifcObjectReferenceSelect as IfcMaterialLayer;

            if (layer != null)
            {
                IfcMaterialLayer ifcMaterialLayer = layer;
                string           value            = string.Empty;
                if (ifcMaterialLayer.Material != null)
                {
                    value += ifcMaterialLayer.Material.Name.ToString();
                }
                if (string.IsNullOrEmpty(value))
                {
                    value = ifcMaterialLayer.LayerThickness.Value.ToString();
                }
                else
                {
                    value += "(" + ifcMaterialLayer.LayerThickness.Value + ")";
                }
                return(value);
            }
            var reference = ifcObjectReferenceSelect as IfcExternalReference;

            if (reference != null)
            {
                if (reference.Location.HasValue)
                {
                    return(reference.Location.ToString());
                }
                return(string.Empty);
            }
            var series = ifcObjectReferenceSelect as IfcTimeSeries;

            if (series != null)
            {
                return(series.GetAsString());
            }
            var address = ifcObjectReferenceSelect as IfcAddress;

            if (address != null)
            {
                return(address.GetAsString());
            }
            var appliedValue = ifcObjectReferenceSelect as IfcAppliedValue;

            if (appliedValue != null)
            {
                return(appliedValue.AsString());
            }

            return(string.Empty);
        }
コード例 #14
0
ファイル: IFCExtensions.cs プロジェクト: simonmoreau/elements
 private static MaterialLayer ToMaterialLayer(this IfcMaterialLayer layer)
 {
     return(new MaterialLayer(layer.Material.ToMaterial(), (IfcLengthMeasure)layer.LayerThickness));
 }
コード例 #15
0
        /// <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);
        }
コード例 #16
0
        private static void AdjustExtrusion(XbimModel model, IfcExtrudedAreaSolid body, HndzStructuralElement genericProducthndz,
                                            IfcProduct genericProductIfc)
        {
            IfcCartesianPoint axisOrigin = model.Instances.New <IfcCartesianPoint>();

            axisOrigin.SetXYZ(0, 0, 0);

            IfcCartesianPoint elementStartPoint = model.Instances.New <IfcCartesianPoint>();

            elementStartPoint.SetXYZ(genericProducthndz.ExtrusionLine.baseNode.Point.X,
                                     genericProducthndz.ExtrusionLine.baseNode.Point.Y, genericProducthndz.ExtrusionLine.baseNode.Point.Z); //insert at arbitrary position//****************Need Revision


            body.Depth             = genericProducthndz.ExtrusionLine.RhinoLine.Length;
            body.ExtrudedDirection = model.Instances.New <IfcDirection>();
            body.ExtrudedDirection.SetXYZ(0, 0, 1);

            //parameters to insert the geometry in the model

            body.Position          = model.Instances.New <IfcAxis2Placement3D>();
            body.Position.Location = axisOrigin;

            //body.Position.RefDirection = model.Instances.New<IfcDirection>();
            //body.Position.RefDirection.SetXYZ(1, 0, 0);

            //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(body);

            //Create a Product Definition and add the model geometry to the wall
            IfcProductDefinitionShape rep = model.Instances.New <IfcProductDefinitionShape>();

            rep.Representations.Add(shape);
            genericProductIfc.Representation = rep;

            //now place the wall into the model
            #region ProfileVectorDir.

            Vector3d perpendicularVector = new Vector3d(genericProducthndz.Profile.OrientationInPlane.X, genericProducthndz.Profile.OrientationInPlane.Y, 0);
            Plane    extrusionPlane;

            bool aa = genericProducthndz.ExtrusionLine.RhinoLine.TryGetPlane(out extrusionPlane);
            if (aa)
            {
                perpendicularVector = extrusionPlane.ZAxis;
            }

            // Vector3d elementDirection = genericProducthndz.ExtrusionLine.RhinoLine.Direction;
            //Plane profilePlane = new Plane(genericProducthndz.ExtrusionLine.baseNode.Point, elementDirection);
            // Vector3d profileXdirection = profilePlane.XAxis;

            #endregion
            IfcLocalPlacement   lp   = model.Instances.New <IfcLocalPlacement>();
            IfcAxis2Placement3D ax3D = model.Instances.New <IfcAxis2Placement3D>();
            ax3D.Location     = elementStartPoint;
            ax3D.RefDirection = model.Instances.New <IfcDirection>();
            ax3D.RefDirection.SetXYZ(perpendicularVector.X, perpendicularVector.Y, perpendicularVector.Z);  //Y-Axis
            //ax3D.RefDirection.SetXYZ(0, 1, 0);  //Y-Axis
            ax3D.Axis = model.Instances.New <IfcDirection>();
            ax3D.Axis.SetXYZ(genericProducthndz.ExtrusionLine.RhinoLine.Direction.X, genericProducthndz.ExtrusionLine.RhinoLine.Direction.Y, genericProducthndz.ExtrusionLine.RhinoLine.Direction.Z);          //Z-Axis


            //XbimVector3D X_Dir = new XbimVector3D(extrusionPlane.XAxis.X, extrusionPlane.XAxis.Y, extrusionPlane.XAxis.Z);
            //XbimVector3D Y_Dir = new XbimVector3D(extrusionPlane.YAxis.X, extrusionPlane.YAxis.Y, extrusionPlane.YAxis.Z);
            //XbimVector3D Z_Dir = new XbimVector3D(extrusionPlane.ZAxis.X, extrusionPlane.ZAxis.Y, extrusionPlane.ZAxis.Z);
            //ax3D.P.Insert(0,X_Dir);
            //ax3D.P.Insert(1,Y_Dir);
            //ax3D.P.Insert(2,Z_Dir);

            lp.RelativePlacement = ax3D;
            genericProductIfc.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(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 = "STEEL";
            IfcRelAssociatesMaterial ifcRelAssociatesMaterial = model.Instances.New <IfcRelAssociatesMaterial>();
            ifcRelAssociatesMaterial.RelatingMaterial = material;
            ifcRelAssociatesMaterial.RelatedObjects.Add(genericProductIfc);

            ifcRelAssociatesMaterial.RelatingMaterial = ifcMaterialLayerSetUsage;

            // IfcPresentationLayerAssignment is required for CAD presentation in IfcWall or IfcWallStandardCase
            IfcPresentationLayerAssignment ifcPresentationLayerAssignment = model.Instances.New <IfcPresentationLayerAssignment>();
            ifcPresentationLayerAssignment.Name = "HANDZteel Assignment";
            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(genericProducthndz.ExtrusionLine.baseNode.Point.X, genericProducthndz.ExtrusionLine.baseNode.Point.Y);
            IfcCartesianPoint endPoint = model.Instances.New <IfcCartesianPoint>();
            endPoint.SetXY(genericProducthndz.ExtrusionLine.EndNode.Point.X, genericProducthndz.ExtrusionLine.EndNode.Point.Y);
            ifcPolyline.Points.Add(startPoint);
            ifcPolyline.Points.Add(endPoint);

            IfcShapeRepresentation shape2D = model.Instances.New <IfcShapeRepresentation>();
            shape2D.ContextOfItems           = model.IfcProject.ModelContext();
            shape2D.RepresentationIdentifier = "Axis";
            shape2D.RepresentationType       = "Curve2D";
            shape2D.Items.Add(ifcPolyline);
            rep.Representations.Add(shape2D);
        }
コード例 #17
0
        static IfcMaterial extractMaterial(IfcMaterialSelect materialSelect)         //To be enabled in opensource Library
        {
            IfcMaterial material = materialSelect as IfcMaterial;

            if (material != null)
            {
                return(material);
            }
            IfcMaterialProfile profile = materialSelect as IfcMaterialProfile;

            if (profile != null)
            {
                return(profile.Material);
            }
            IfcMaterialProfileSet profileSet = materialSelect as IfcMaterialProfileSet;

            if (profileSet == null)
            {
                IfcMaterialProfileSetUsage profileUsage = materialSelect as IfcMaterialProfileSetUsage;
                if (profileUsage != null)
                {
                    profileSet = profileUsage.ForProfileSet;
                }
            }
            if (profileSet != null)
            {
                return(profileSet.PrimaryMaterial);
            }
            IfcMaterialLayer layer = materialSelect as IfcMaterialLayer;

            if (layer != null)
            {
                return(layer.Material);
            }
            IfcMaterialLayerSet layerSet = materialSelect as IfcMaterialLayerSet;

            if (layerSet != null)
            {
                return(layerSet.PrimaryMaterial);
            }
            IfcMaterialLayerSetUsage layerSetUsage = materialSelect as IfcMaterialLayerSetUsage;

            if (layerSetUsage != null)
            {
                return(layerSetUsage.PrimaryMaterial);
            }
            IfcMaterialList list = materialSelect as IfcMaterialList;

            if (list != null)
            {
                return(list.PrimaryMaterial);
            }
            IfcMaterialConstituent constituent = materialSelect as IfcMaterialConstituent;

            if (constituent != null)
            {
                return(constituent.PrimaryMaterial);
            }
            IfcMaterialConstituentSet constituentSet = materialSelect as IfcMaterialConstituentSet;

            if (constituentSet != null)
            {
                return(constituentSet.PrimaryMaterial);
            }
            return(null);
        }
コード例 #18
0
        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;
            });
        }