Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            DatabaseIfc            db          = new DatabaseIfc(Console.In);
            IfcProject             project     = db.Project;
            IfcSpatialElement      rootElement = project.RootElement();
            List <IfcBuiltElement> elements    = project.Extract <IfcBuiltElement>();         //IfcBuiltElement renamed from IfcBuildingElement
            List <IfcFacetedBrep>  breps       = new List <IfcFacetedBrep>();

            foreach (IfcBuiltElement element in elements)
            {
                IfcProductDefinitionShape representation = element.Representation;
                if (representation != null)
                {
                    foreach (IfcShapeModel rep in representation.Representations)
                    {
                        IfcShapeRepresentation sr = rep as IfcShapeRepresentation;
                        if (sr != null)
                        {
                            foreach (IfcRepresentationItem item in sr.Items)
                            {
                                IfcFacetedBrep fb = item as IfcFacetedBrep;
                                if (fb != null)
                                {
                                    breps.Add(fb);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            DatabaseIfc               db          = new DatabaseIfc(Console.In);
            IfcProject                project     = db.Project;
            IfcSpatialElement         rootElement = project.RootElement;
            List <IfcBuildingElement> elements    = project.Extract <IfcBuildingElement>();
            List <IfcFacetedBrep>     breps       = new List <IfcFacetedBrep>();

            foreach (IfcBuildingElement element in elements)
            {
                List <IfcRepresentation> reps = element.Representation.Representations;
                foreach (IfcRepresentation rep in reps)
                {
                    IfcShapeRepresentation sr = rep as IfcShapeRepresentation;
                    if (sr != null)
                    {
                        List <IfcRepresentationItem> items = sr.Items;
                        foreach (IfcRepresentationItem item in items)
                        {
                            IfcFacetedBrep fb = item as IfcFacetedBrep;
                            if (fb != null)
                            {
                                breps.Add(fb);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void openFileButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "ifc|*.ifc";
            ofd.ShowDialog();

            DatabaseIfc               db          = new DatabaseIfc(ofd.FileName);
            IfcProject                project     = db.Project;
            IfcSpatialElement         rootElement = project.RootElement;
            List <IfcBuildingElement> elements    = project.Extract <IfcBuildingElement>();
            List <IfcFacetedBrep>     breps       = new List <IfcFacetedBrep>();

            foreach (IfcBuildingElement element in elements)
            {
                //outputLabel.Content += element.Name+ "\n";
                IfcProductRepresentation representation = element.Representation;
                if (representation != null)
                {
                    foreach (IfcRepresentation rep in representation.Representations)
                    {
                        IfcShapeRepresentation sr = rep as IfcShapeRepresentation;
                        if (sr != null)
                        {
                            foreach (IfcRepresentationItem item in sr.Items)
                            {
                                Debug.WriteLine(item.GetType());
                                IfcFacetedBrep fb = item as IfcFacetedBrep;
                                if (fb != null)
                                {
                                    breps.Add(fb);
                                    outputLabel.Content += fb + "\n";
                                    /// Each IfcFacetedBrep has one IfcClosedShell called "Outer".
                                    /// IfcClosedShell has several IfcFaces called CfsFaces
                                    //foreach (var face in fb.Outer.CfsFaces)
                                    //{
                                    //    /// IfcFace has several IfcFaceOuterBounds called bounds
                                    //    foreach(var bound in face.Bounds)
                                    //    {
                                    //        /// Each IfcFaceOuterBound inherited from IfcFacetedBrep has IfcPolyLoop
                                    //        var loop = bound.Bound as IfcPolyloop;
                                    //        if(loop != null)
                                    //        {
                                    //            foreach(var point in loop.Polygon)
                                    //            {
                                    //               //point.Coordinates;
                                    //                outputLabel.Content += point.Coordinates + "\n";
                                    //            }
                                    //        }
                                    //    }
                                    //}
                                    //outputLabel.Content += fb.ToString() + "\n";
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Compares two objects for geomtric equality
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b">object to compare with</param>
        /// <returns></returns>
        public static bool GeometricEquals(this IfcManifoldSolidBrep a, IfcRepresentationItem b)
        {
            IfcFacetedBrep fb = b as IfcFacetedBrep;

            if (fb == null)
            {
                return(false);            //different types are not the same
            }
            if (a.Equals(fb))
            {
                return(true);
            }
            return(a.Outer.GeometricEquals(fb.Outer));
        }
Ejemplo n.º 5
0
        public BbBRepGeometry(
            IList <BbFace> faces
            )
        {
            var _faces = new List <IfcFace> ();

            foreach (var item in faces)
            {
                _faces.Add(item.IfcFace);
            }

            ifcFacetedBrep = new IfcFacetedBrep {
                Outer = new IfcClosedShell {
                    CfsFaces = _faces,
                },
//				SweptArea = profile.IfcProfileDef,
//				Position = position3D.IfcAxis2Placement3D,
//				ExtrudedDirection = direction3D.IfcDirection,
//				Depth = depth,
            };

            _ifcShapeRepresentation = new IfcShapeRepresentation
            {
                ContextOfItems           = BbHeaderSetting.Setting3D.GeometricRepresentationContext,
                RepresentationIdentifier = "Body",
                RepresentationType       = "Brep",
                Items = new List <IfcRepresentationItem>(),
            };
            _ifcShapeRepresentation.Items.Add(ifcFacetedBrep);

            _ifcProductDefinitionShape = new IfcProductDefinitionShape
            {
                // Name=
                // Description =
                Representations = new List <IfcRepresentation>(),
            };
            _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation);
        }
Ejemplo n.º 6
0
        public BbBRepGeometry(
			IList<BbFace> faces
		)
        {
            var _faces = new List<IfcFace> ();
            foreach (var item in faces) {
                _faces.Add(item.IfcFace);
            }

            ifcFacetedBrep = new IfcFacetedBrep{
                Outer = new IfcClosedShell{
                    CfsFaces = _faces,
                },
            //				SweptArea = profile.IfcProfileDef,
            //				Position = position3D.IfcAxis2Placement3D,
            //				ExtrudedDirection = direction3D.IfcDirection,
            //				Depth = depth,
            };

            _ifcShapeRepresentation = new IfcShapeRepresentation
            {
                ContextOfItems = BbHeaderSetting.Setting3D.GeometricRepresentationContext,
                RepresentationIdentifier = "Body",
                RepresentationType = "Brep",
                Items = new List<IfcRepresentationItem>(),
            };
            _ifcShapeRepresentation.Items.Add(ifcFacetedBrep);

            _ifcProductDefinitionShape = new IfcProductDefinitionShape
            {
                // Name=
                // Description =
                Representations = new List<IfcRepresentation>(),
            };
            _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation);
        }
Ejemplo n.º 7
0
		internal enum ShapeRep { AdvancedBrep, Brep, Tessellation } //,CSG, ClosedShell
		internal static void GenerateBasin(ShapeRep shapeRep, STPModelData md, IfcBuilding building)
		{
			md.NextObjectRecord = 500;
			IfcRepresentationMap representationMap = null;
			if (shapeRep == ShapeRep.AdvancedBrep)
			{
				#region advancedBrep
				IfcCartesianPoint cp1 = new IfcCartesianPoint(md, 0.0, 253.099263998677, 0.0);
				cp1.Comments.Add("geometry definition of the advanced brep");
				IfcCartesianPoint cp2 = new IfcCartesianPoint(md, 0.0, 247.792422124388, -83.9999999999991);
				IfcCartesianPoint cp3 = new IfcCartesianPoint(md, 0.0, 268.843232748677, 0.0);
				IfcCartesianPoint cp4 = new IfcCartesianPoint(md, 0.0, 247.792422124388, -93.9999999999991);
				IfcVertexPoint vp1 = new IfcVertexPoint(cp1), vp2 = new IfcVertexPoint(cp2), vp3 = new IfcVertexPoint(cp3),vp4 = new IfcVertexPoint(cp4);

				IfcEdgeCurve edgeCurve1 = new IfcEdgeCurve(vp1, vp2, new IfcPolyline(cp1, cp2), true); //140
				List<Point3d> points3d = new List<Point3d>() { new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991), new Point3d(0.0, -108.13323051355, -83.9999999999991), new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991) };
				IfcBSplineCurveWithKnots nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points3d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List<int>() { 1,1, 1, 1, 1, 1, 1, 1, 1, 1,1 }, new List<double>() { -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0,3.0 }, IfcKnotType.UNSPECIFIED);
				IfcEdgeCurve edgeCurve2 = new IfcEdgeCurve(vp2, vp2, nurbsCurve, true); //149
				List<Point2d> points2d = new List<Point2d>() { new Point2d(-437.751000004175, 168.150654933496), new Point2d(0.0, 295.573568531267), new Point2d(437.751000006541, 168.150654933498), new Point2d(0.0, -290.713822148428), new Point2d(-437.751000004175, 168.150654933496), new Point2d(0.0, 295.573568531267), new Point2d(437.751000006541, 168.150654933498) };
				nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points2d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List<int>() { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ,1}, new List<double>() { -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0 }, IfcKnotType.UNSPECIFIED);
				IfcEdgeCurve edgeCurve3 = new IfcEdgeCurve(vp1, vp1, nurbsCurve, true); //158
				IfcEdgeCurve edgeCurve4 = new IfcEdgeCurve(vp3, vp4, new IfcPolyline(cp3, cp4), true); //162
				points3d = new List<Point3d>() { new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991), new Point3d(0.0, -108.133230500215, -93.9999999999991), new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991) };
				nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points3d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List<int>() { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new List<double>() { -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0 }, IfcKnotType.UNSPECIFIED);
				IfcEdgeCurve edgeCurve5 = new IfcEdgeCurve(vp4, vp4, nurbsCurve, true); //171
				points2d = new List<Point2d>() { new Point2d(457.685108750143, 177.051077752302), new Point2d(0.0, 314.739310246865), new Point2d(-457.685108750141, 177.051077752299), new Point2d(0.0, -318.77998625438), new Point2d(457.685108750143, 177.051077752302), new Point2d(0.0, 314.739310246865), new Point2d(-457.685108750141, 177.051077752299) };
				nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points2d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List<int>() { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new List<double>() { -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0 }, IfcKnotType.UNSPECIFIED);
				IfcEdgeCurve edgeCurve6 = new IfcEdgeCurve(vp3, vp3, nurbsCurve, true); //181

				List<IfcOrientedEdge> orientedEdges = new List<IfcOrientedEdge>();
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve1, true));
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve2, true));
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve1, false));
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve3, true));
				IfcFaceOuterBound faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdges), true);
				List<List<Point3d>> surfaceControlPoints = new List<List<Point3d>>();
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(437.751000006541, 168.150654933498, 0.0), new Point3d(0.0, 295.573568531267, 0.0), new Point3d(-437.751000004175, 168.150654933496, 0.0), new Point3d(0.0, -290.713822148428, 0.0), new Point3d(437.751000006541, 168.150654933498, 0.0), new Point3d(0.0, 295.573568531267, 0.0), new Point3d(-437.751000004175, 168.150654933496, 0.0) });
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(371.75340451674, 176.164956423972, -27.9999999999997), new Point3d(0.0, 288.912996848885, -27.9999999999997), new Point3d(-371.753404513767, 176.16495642397, -27.9999999999997), new Point3d(0.0, -229.853624936802, -27.9999999999997), new Point3d(371.75340451674, 176.164956423972, -27.9999999999997), new Point3d(0.0, 288.912996848885, -27.9999999999997), new Point3d(-371.753404513767, 176.16495642397, -27.9999999999997) });
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(305.75580902694, 184.179257914445, -55.9999999999994), new Point3d(0.0, 282.252425166504, -55.9999999999994), new Point3d(-305.755809023358, 184.179257914444, -55.9999999999994), new Point3d(0.0, -168.993427725176, -55.9999999999994), new Point3d(305.75580902694, 184.179257914445, -55.9999999999994), new Point3d(0.0, 282.252425166504, -55.9999999999994), new Point3d(-305.755809023358, 184.179257914444, -55.9999999999994) });
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991), new Point3d(0.0, -108.13323051355, -83.9999999999991), new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991) });
				List<int> uMults = new List<int>() { 4, 4 }, vMults = new List<int>() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1 };
				List<double> uKnots = new List<double>() { 0.0, 14.7110308353668 };
				List<double> vKnots = new List<double>() { -7, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0,3.0 };
				IfcBSplineSurfaceWithKnots nurbsSurface = new IfcBSplineSurfaceWithKnots(md, 3, 3, surfaceControlPoints, IfcBSplineSurfaceForm.UNSPECIFIED, IfcLogicalEnum.FALSE, IfcLogicalEnum.TRUE, IfcLogicalEnum.FALSE, uMults, vMults, uKnots, vKnots, IfcKnotType.UNSPECIFIED);
				IfcAdvancedFace face1 = new IfcAdvancedFace(faceOuterBound, nurbsSurface, false);

				orientedEdges = new List<IfcOrientedEdge>();
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve4, true));
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve5, true));
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve4, false));
				orientedEdges.Add(new IfcOrientedEdge(edgeCurve6, true));
				faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdges), true);
				surfaceControlPoints = new List<List<Point3d>>();
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(-457.685108750141, 177.051077752299, 0.0), new Point3d(0.0, 314.739310246865, 0.0), new Point3d(457.685108750143, 177.051077752302, 0.0), new Point3d(0.0, -318.77998625438, 0.0), new Point3d( -457.685108750141, 177.051077752299, 0.0), new Point3d(0.0, 314.739310246865, 0.0), new Point3d(457.685108750143, 177.051077752302, 0.0) });
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(-385.042810345109, 182.098571627615, -31.333333333333), new Point3d(0.0, 301.690157997063, -31.333333333333), new Point3d(385.04281034511, 182.098571627617, -31.333333333333), new Point3d(0.0, -248.564401002992, -31.333333333333), new Point3d(-385.042810345109, 182.098571627615, -31.333333333333), new Point3d(0.0, 301.690157997063, -31.333333333333), new Point3d(385.04281034511, 182.098571627617, -31.333333333333) });
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(-312.400511940076, 187.146065502931, -62.666666666666), new Point3d(0.0, 288.64100574726, -62.666666666666), new Point3d(312.400511940078, 187.146065502933, -62.666666666666), new Point3d(0.0, -178.348815751603, -62.6666666666661), new Point3d(-312.400511940076, 187.146065502931, -62.666666666666), new Point3d(0.0, 288.64100574726, -62.666666666666), new Point3d(312.400511940078, 187.146065502933, -62.666666666666) });
				surfaceControlPoints.Add(new List<Point3d>() { new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991), new Point3d(0.0, -108.133230500215, -93.9999999999991), new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991) });
				uMults = new List<int>() { 4, 4 };
				vMults = new List<int>() { 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1 };
				uKnots = new List<double>() { 0.0, 15.4213505620632 };
				vKnots = new List<double>() { -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 };
				nurbsSurface = new IfcBSplineSurfaceWithKnots(md, 3, 3, surfaceControlPoints, IfcBSplineSurfaceForm.UNSPECIFIED, IfcLogicalEnum.FALSE, IfcLogicalEnum.TRUE, IfcLogicalEnum.FALSE, uMults, vMults, uKnots, vKnots, IfcKnotType.UNSPECIFIED);
				IfcAdvancedFace face2 = new IfcAdvancedFace(faceOuterBound, nurbsSurface, false);
				
				IfcOrientedEdge orientedEdge = new IfcOrientedEdge(edgeCurve2, false);
				faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdge), true);
				IfcPlane plane = new IfcPlane(new IfcAxis2Placement3D(cp2, null,null));
				IfcAdvancedFace face3 = new IfcAdvancedFace(faceOuterBound, plane, true);
			
				orientedEdge = new IfcOrientedEdge(edgeCurve5, true);
				faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdge),true);
				plane = new IfcPlane(new IfcAxis2Placement3D(cp4, null, null));
				IfcAdvancedFace face4 = new IfcAdvancedFace(faceOuterBound, plane, false);

				orientedEdge = new IfcOrientedEdge(edgeCurve6, false);
				faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdge),true);
				orientedEdge = new IfcOrientedEdge(edgeCurve3, false);
				IfcFaceBound facebound = new IfcFaceBound(new IfcEdgeLoop(orientedEdge), true);
				plane = new IfcPlane(new IfcAxis2Placement3D(cp1, null, null));
				IfcAdvancedFace face5 = new IfcAdvancedFace(faceOuterBound,facebound, plane, true);

				IfcAdvancedBrep advancedBrep = new IfcAdvancedBrep(new List<IfcAdvancedFace>() { face1, face2, face3, face4, face5 });
				representationMap = new IfcRepresentationMap(advancedBrep);
				#endregion
			}
			else if (shapeRep == ShapeRep.Brep)
			{
				#region facetedBrep
				List<IfcCartesianPoint> cps = new List<IfcCartesianPoint>();

				List<IfcFace> faces = new List<IfcFace>();

				cps.Add(new IfcCartesianPoint(md, 8.5265128291212E-14, 268.843232748677, 0));
				cps.Add(new IfcCartesianPoint(md, -40.6565545240771, 267.741230885222, 0));
				cps.Add(new IfcCartesianPoint(md, -81.1844472420702, 264.337146165631, 0));
				cps.Add(new IfcCartesianPoint(md, -121.414523219646, 258.379966740374, 0));
				cps.Add(new IfcCartesianPoint(md, -161.084488243579, 249.439282575701, 0));
				cps.Add(new IfcCartesianPoint(md, -199.732402407963, 236.816640911423, 0));
				cps.Add(new IfcCartesianPoint(md, -236.448287386336, 219.398404238099, 0));
				cps.Add(new IfcCartesianPoint(md, -269.269780991348, 195.519340118616, 0));
				cps.Add(new IfcCartesianPoint(md, -294.036921021401, 163.504056083023, 0));
				cps.Add(new IfcCartesianPoint(md, -304.879990220018, 124.598157305706, 0));
				cps.Add(new IfcCartesianPoint(md, -300.744331060112, 84.2991194842604, 0));
				cps.Add(new IfcCartesianPoint(md, -286.871978591032, 46.1280924370721, 0));
				cps.Add(new IfcCartesianPoint(md, -267.00397578777, 10.6705825582408, 0));
				cps.Add(new IfcCartesianPoint(md, -242.91417242145, -22.0789599923818, 0));
				cps.Add(new IfcCartesianPoint(md, -215.49737582355, -52.1038389186614, 0));
				cps.Add(new IfcCartesianPoint(md, -185.233564258487, -79.2577607647334, 0));
				cps.Add(new IfcCartesianPoint(md, -152.394753430662, -103.231127678777, 0));
				cps.Add(new IfcCartesianPoint(md, -117.162752124351, -123.516605031891, 0));
				cps.Add(new IfcCartesianPoint(md, -79.7327064970238, -139.366465926728, 0));
				cps.Add(new IfcCartesianPoint(md, -40.4494524879168, -149.766330003707, 0));
				cps.Add(new IfcCartesianPoint(md, -8.5265128291212E-14, -153.50296491882, 0));
				cps.Add(new IfcCartesianPoint(md, 40.4494508793845, -149.766330296203, 0));
				cps.Add(new IfcCartesianPoint(md, 79.7327043771191, -139.366466661145, 0));
				cps.Add(new IfcCartesianPoint(md, 117.162756918928, -123.516602630764, 0));
				cps.Add(new IfcCartesianPoint(md, 152.394751766558, -103.231128764915, 0));
				cps.Add(new IfcCartesianPoint(md, 185.23356996992, -79.2577561301781, 0));
				cps.Add(new IfcCartesianPoint(md, 215.497373929206, -52.103840795184, 0));
				cps.Add(new IfcCartesianPoint(md, 242.914167878755, -22.078965508489, 0));
				cps.Add(new IfcCartesianPoint(md, 267.003976250216, 10.6705832692101, 0));
				cps.Add(new IfcCartesianPoint(md, 286.871977954697, 46.1280910808867, 0));
				cps.Add(new IfcCartesianPoint(md, 300.744329678325, 84.2991139637225, 0));
				cps.Add(new IfcCartesianPoint(md, 304.879990112863, 124.598158883845, 0));
				cps.Add(new IfcCartesianPoint(md, 294.036920669161, 163.504056764251, 0));
				cps.Add(new IfcCartesianPoint(md, 269.269779973882, 195.519341068674, 0));
				cps.Add(new IfcCartesianPoint(md, 236.44828639794, 219.398404808304, 0));
				cps.Add(new IfcCartesianPoint(md, 199.73240148445, 236.816641271916, 0));
				cps.Add(new IfcCartesianPoint(md, 161.084487568103, 249.439282758701, 0));
				cps.Add(new IfcCartesianPoint(md, 121.414531991753, 258.379965126806, 0));
				cps.Add(new IfcCartesianPoint(md, 81.1844476691385, 264.337146116746, 0));
				cps.Add(new IfcCartesianPoint(md, 40.6565563813857, 267.741230783552, 0));


				IfcPolyloop polyloop = new IfcPolyloop(cps.GetRange(0,40));
				IfcFaceOuterBound faceOuterBound = new IfcFaceOuterBound(polyloop,true);

				cps.Add(new IfcCartesianPoint(md, -2.36369146477955E-09, 253.099263998677, 0));
				cps.Add(new IfcCartesianPoint(md, 38.4274900386849, 252.103548079205, 0));
				cps.Add(new IfcCartesianPoint(md, 76.7439433401587, 249.028666176807, 0));
				cps.Add(new IfcCartesianPoint(md, 114.803789550381, 243.649797844599, 0));
				cps.Add(new IfcCartesianPoint(md, 152.382048016624, 235.580438211911, 0));
				cps.Add(new IfcCartesianPoint(md, 189.083091558087, 224.18969850467, 0));
				cps.Add(new IfcCartesianPoint(md, 224.125137689733, 208.456936531179, 0));
				cps.Add(new IfcCartesianPoint(md, 255.793363304913, 186.795125569967, 0));
				cps.Add(new IfcCartesianPoint(md, 280.260264776878, 157.383008003324, 0));
				cps.Add(new IfcCartesianPoint(md, 291.499069651162, 120.929075349148, 0));
				cps.Add(new IfcCartesianPoint(md, 287.781794186053, 82.8439932251812, 0));
				cps.Add(new IfcCartesianPoint(md, 274.333349777552, 46.8976139888769, 0));
				cps.Add(new IfcCartesianPoint(md, 255.041935323226, 13.6804471549583, 0));
				cps.Add(new IfcCartesianPoint(md, 231.718321168942, -16.8550204261573, 0));
				cps.Add(new IfcCartesianPoint(md, 205.26490842152, -44.72871539005, 0));
				cps.Add(new IfcCartesianPoint(md, 176.16701831263, -69.8307253653909, 0));
				cps.Add(new IfcCartesianPoint(md, 144.705875892003, -91.8966701176456, 0));
				cps.Add(new IfcCartesianPoint(md, 111.075533913924, -110.483174825384, 0));
				cps.Add(new IfcCartesianPoint(md, 75.4792575648176, -124.93688849428, 0));
				cps.Add(new IfcCartesianPoint(md, 38.2480241625981, -134.377886037238, 0));
				cps.Add(new IfcCartesianPoint(md, -1.27897692436818E-13, -137.758996454453, 0));
				cps.Add(new IfcCartesianPoint(md, -38.2480094096726, -134.377888604729, 0));
				cps.Add(new IfcCartesianPoint(md, -75.4792556281902, -124.936889137129, 0));
				cps.Add(new IfcCartesianPoint(md, -111.075539062433, -110.483172351871, 0));
				cps.Add(new IfcCartesianPoint(md, -144.705874376312, -91.8966710674264, 0));
				cps.Add(new IfcCartesianPoint(md, -176.167011118929, -69.8307309751332, 0));
				cps.Add(new IfcCartesianPoint(md, -205.264906834, -44.7287169020584, 0));
				cps.Add(new IfcCartesianPoint(md, -231.718318258428, -16.855023827089, 0));
				cps.Add(new IfcCartesianPoint(md, -255.041934669669, 13.6804461875579, 0));
				cps.Add(new IfcCartesianPoint(md, -274.333348315742, 46.8976109786559, 0));
				cps.Add(new IfcCartesianPoint(md, -287.781793945095, 82.843992280873, 0));
				cps.Add(new IfcCartesianPoint(md, -291.499069558299, 120.929076449465, 0));
				cps.Add(new IfcCartesianPoint(md, -280.260264225365, 157.383008985549, 0));
				cps.Add(new IfcCartesianPoint(md, -255.793362494351, 186.795126279187, 0));
				cps.Add(new IfcCartesianPoint(md, -224.12513653713, 208.45693715988, 0));
				cps.Add(new IfcCartesianPoint(md, -189.083091723532, 224.189698444526, 0));
				cps.Add(new IfcCartesianPoint(md, -152.382036267776, 235.580441242109, 0));
				cps.Add(new IfcCartesianPoint(md, -114.803784949771, 243.649798652405, 0));
				cps.Add(new IfcCartesianPoint(md, -76.7439536078398, 249.028665054834, 0));
				cps.Add(new IfcCartesianPoint(md, -38.4274901357192, 252.103548074371, 0));

				
				polyloop = new IfcPolyloop(cps.GetRange(40,40));
				IfcFaceBound faceBound = new IfcFaceBound(polyloop,true);
				faces.Add(new IfcFace(faceOuterBound,faceBound));

				cps.Add(new IfcCartesianPoint(md, 7.105427357601E-14, 247.792422124388, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 22.543570345102, 247.043703986819, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 44.9796137172465, 244.728140008744, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 67.1650892668505, 240.670010701811, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 88.8758496727837, 234.574313720423, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 109.718194276454, 225.983554212619, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 128.945156504883, 214.242543022066, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 145.131083023098, 198.61702521984, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 156.028264873931, 178.980157903609, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 159.834545208795, 156.846549510419, -93.999999999999));
				cps.Add(new IfcCartesianPoint(md, 157.205129966729, 134.492794130245, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 150.333031384556, 113.029267864972, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 140.585417581734, 92.698690766237, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 128.649651812238, 73.5661983153641, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 114.88081683599, 55.7059230027226, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 99.4572081299554, 39.2537668954707, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 82.4557792492348, 24.4401234195301, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 63.9015117223512, 11.6305834057239, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 43.825812852227, 1.38178464649553, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 22.3741376569279, -5.50526474040419, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 1.4210854715202E-14, -8.02430054072738, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -22.3741369000302, -5.50526490804053, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -43.8258109334306, 1.38178384202005, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -63.9015107453348, 11.6305828171828, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -82.4557778416754, 24.4401223202192, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -99.4572071589388, 39.2537659566927, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -114.880815789293, 55.7059217719804, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -128.649650827451, 73.5661969013759, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -140.585419271271, 92.6986938201311, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -150.333030863305, 113.029266577227, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -157.205128832971, 134.492789207233, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -159.834545214161, 156.846549002985, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -156.028266010736, 178.980154672375, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -145.131082712872, 198.617025613766, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -128.945159904117, 214.242540461469, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -109.718192999937, 225.983554847043, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -88.8758510792069, 234.574313243064, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -67.16508882249, 240.670010803143, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -44.9796135673833, 244.728140029868, -93.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -22.5435788308204, 247.043703417137, -93.9999999999991));

				polyloop = new IfcPolyloop(cps.GetRange(80, 40));
				faceOuterBound = new IfcFaceOuterBound(polyloop, true);
				faces.Add(new IfcFace(faceOuterBound));

				cps.Add(new IfcCartesianPoint(md, -4.18794598999739E-09, 247.792422124388, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -22.5435703494529, 247.043703987136, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -44.9796137218369, 244.728140009905, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -67.1650892718133, 240.670010704167, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -88.8758496782756, 234.574313724111, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -109.718194282579, 225.983554217461, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -128.945156511477, 214.24254302742, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -145.131083029256, 198.617025224586, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -156.028264877734, 178.980157906939, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -159.834545208922, 156.846549512965, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -157.205129964107, 134.492794132934, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -150.333031380544, 113.029267867934, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -140.585417577166, 92.6986907692923, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -128.649651807611, 73.5661983182769, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -114.88081683159, 55.7059230052684, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -99.4572081259275, 39.2537668974612, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -82.45577924561, 24.4401234208308, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -63.9015117190565, 11.6305834062858, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -43.8258128490947, 1.38178464641787, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -22.374137653742, -5.50526474077583, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, -5.6843418860808E-14, -8.02430054072741, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 22.374136903413, -5.50526490696816, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 43.8258109365215, 1.38178384447853, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 63.9015107478721, 11.6305828210529, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 82.4557778435065, 24.4401223253757, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 99.4572071600111, 39.2537659629489, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 114.880815789634, 55.7059217791287, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 128.64965082716, 73.5661969092022, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 140.585419270523, 92.6986938284213, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 150.333030862371, 113.029266585776, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 157.205128832256, 134.492789215875, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 159.834545214197, 156.846549011699, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 156.028266011557, 178.980154681359, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 145.131082713423, 198.617025622727, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 128.945159903547, 214.242540469453, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 109.718192998164, 225.983554853335, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 88.8758510764901, 234.574313247461, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 67.1650888191183, 240.67001080579, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 44.9796135636075, 244.728140031113, -83.9999999999991));
				cps.Add(new IfcCartesianPoint(md, 22.5435788267922, 247.043703417465, -83.9999999999991));


				polyloop = new IfcPolyloop(cps.GetRange(120, 40));
				faceOuterBound = new IfcFaceOuterBound(polyloop, true);
				faces.Add(new IfcFace(faceOuterBound));

				for (int icounter = 0; icounter < 40; icounter++)
				{
					polyloop = new IfcPolyloop(cps[icounter == 39 ? 0 : icounter + 1], cps[icounter], cps[icounter == 0 ? 80 : 120 - icounter]);
					faceOuterBound = new IfcFaceOuterBound(polyloop, true);
					faces.Add(new IfcFace(faceOuterBound));
					polyloop = new IfcPolyloop(cps[80 + (icounter == 39 ? 0 : icounter + 1)], cps[80 + icounter], cps[icounter == 0 ? 0 : 40 - icounter]);
					faceOuterBound = new IfcFaceOuterBound(polyloop, true);
					faces.Add(new IfcFace(faceOuterBound));

					polyloop = new IfcPolyloop(cps[40+( icounter == 39 ? 0 : icounter + 1)], cps[40+icounter], cps[icounter == 0 ? 120 : 160 - icounter]);
					faceOuterBound = new IfcFaceOuterBound(polyloop, true);
					faces.Add(new IfcFace(faceOuterBound));
					polyloop = new IfcPolyloop(cps[120 + (icounter == 39 ? 0 : icounter + 1)], cps[120 + icounter], cps[icounter == 0 ? 40 : 80 - icounter]);
					faceOuterBound = new IfcFaceOuterBound(polyloop, true);
					faces.Add(new IfcFace(faceOuterBound));
				}
				 
				IfcClosedShell closedShell = new IfcClosedShell(faces);
				IfcFacetedBrep facetedBrep = new IfcFacetedBrep(closedShell);
				representationMap = new	IfcRepresentationMap(facetedBrep);
				#endregion
			}
			else if (shapeRep == ShapeRep.Tessellation)
			{
				List<Point3d> points = new List<Point3d>() { new Point3d(-300.0, 150.0, 0.0), new Point3d(-260.012578, 202.771984, 0.0), new Point3d(-200.897703, 235.427328, 0.0), new Point3d(-135.653172, 254.960516, 0.0), new Point3d(-68.351281, 265.485063, 0.0), new Point3d(2.288734, 268.839531, 0.0), new Point3d(72.81782, 265.023844, 0.0), new Point3d(139.786906, 254.038063, 0.0), new Point3d(201.174906, 235.317031, 0.0), new Point3d(259.220938, 203.387031, 0.0), new Point3d(300.0, 150.0, 0.0), new Point3d(301.12175, 84.866148, 0.0), new Point3d(274.727594, 21.433672, 0.0), new Point3d(235.605922, -32.723826, 0.0), new Point3d(186.088641, -80.939688, 0.0), new Point3d(130.136258, -119.016594, 0.0), new Point3d(67.084977, -144.523266, 0.0), new Point3d(1.477218, -153.498641, 0.0), new Point3d(-64.392137, -145.234375, 0.0), new Point3d(-128.935, -119.668008, 0.0), new Point3d(-185.4365, -81.474469, 0.0), new Point3d(-235.751609, -32.555805, 0.0), new Point3d(-275.439625, 22.660475, 0.0), new Point3d(-301.2465, 85.400219, 0.0), new Point3d(0.0, 253.099266, 0.0), new Point3d(-65.777992, 249.952375, 0.0), new Point3d(-128.508695, 240.511688, 0.0), new Point3d(-189.983266, 222.998141, 0.0), new Point3d(-246.840234, 193.330969, 0.0), new Point3d(-286.93375, 143.116359, 0.0), new Point3d(-288.338563, 84.231891, 0.0), new Point3d(-263.388344, 25.178932, 0.0), new Point3d(-224.986906, -26.382564, 0.0), new Point3d(-176.642109, -71.667547, 0.0), new Point3d(-122.550633, -106.846461, 0.0), new Point3d(-61.391031, -130.155953, 0.0), new Point3d(1.00923, -137.756953, 0.0), new Point3d(63.202145, -129.69757, 0.0), new Point3d(123.138398, -106.540977, 0.0), new Point3d(176.955734, -71.42018, 0.0), new Point3d(224.650078, -26.756678, 0.0), new Point3d(262.387781, 23.516443, 0.0), new Point3d(288.070906, 83.103938, 0.0), new Point3d(286.93375, 143.116359, 0.0), new Point3d(248.344641, 192.212875, 0.0), new Point3d(191.622094, 222.376281, 0.0), new Point3d(129.659992, 240.269531, 0.0), new Point3d(64.742059, 250.052203, 0.0), new Point3d(-157.154922, 175.808609, -94.0), new Point3d(-136.207516, 207.772813, -94.0), new Point3d(-105.240203, 227.552281, -94.0), new Point3d(-71.061875, 239.383609, -94.0), new Point3d(-35.805801, 245.758375, -94.0), new Point3d(1.198953, 247.790172, -94.0), new Point3d(38.145594, 245.479016, -94.0), new Point3d(73.227336, 238.824875, -94.0), new Point3d(105.385414, 227.485469, -94.0), new Point3d(135.792813, 208.145344, -94.0), new Point3d(157.154922, 175.808609, -94.0), new Point3d(157.742547, 136.356797, -94.0), new Point3d(143.915969, 97.9355, -94.0), new Point3d(123.422102, 65.13209, -94.0), new Point3d(97.482477, 35.927559, -94.0), new Point3d(68.171844, 12.864227, -94.0), new Point3d(35.142449, -2.585266, -94.0), new Point3d(0.77384, -8.021682, -94.0), new Point3d(-33.731801, -3.015985, -94.0), new Point3d(-67.542563, 12.469661, -94.0), new Point3d(-97.140859, 35.603637, -94.0), new Point3d(-123.498414, 65.233859, -94.0), new Point3d(-144.288969, 98.678578, -94.0), new Point3d(-157.807906, 136.680281, -94.0), new Point3d(-300.0, 150.0, 0.0), new Point3d(-228.577453, 162.904313, -47.0), new Point3d(-157.154922, 175.808609, -94.0), new Point3d(-260.012578, 202.771984, 0.0), new Point3d(-136.207516, 207.772813, -94.0), new Point3d(-200.897703, 235.427328, 0.0), new Point3d(-105.240203, 227.552281, -94.0), new Point3d(-135.653172, 254.960516, 0.0), new Point3d(-71.061875, 239.383609, -94.0), new Point3d(-68.351281, 265.485063, 0.0), new Point3d(-35.805801, 245.758375, -94.0), new Point3d(2.288734, 268.839531, 0.0), new Point3d(1.198953, 247.790172, -94.0), new Point3d(72.81782, 265.023844, 0.0), new Point3d(38.145594, 245.479016, -94.0), new Point3d(139.786906, 254.038063, 0.0), new Point3d(73.227336, 238.824875, -94.0), new Point3d(201.174906, 235.317031, 0.0), new Point3d(105.385414, 227.485469, -94.0), new Point3d(259.220938, 203.387031, 0.0), new Point3d(135.792813, 208.145344, -94.0), new Point3d(300.0, 150.0, 0.0), new Point3d(157.154922, 175.808609, -94.0), new Point3d(301.12175, 84.866148, 0.0), new Point3d(157.742547, 136.356797, -94.0), new Point3d(274.727594, 21.433672, 0.0), new Point3d(143.915969, 97.9355, -94.0), new Point3d(235.605922, -32.723826, 0.0), new Point3d(123.422102, 65.13209, -94.0), new Point3d(186.088641, -80.939688, 0.0), new Point3d(97.482477, 35.927559, -94.0), new Point3d(130.136258, -119.016594, 0.0), new Point3d(68.171844, 12.864227, -94.0), new Point3d(67.084977, -144.523266, 0.0), new Point3d(35.142449, -2.585266, -94.0), new Point3d(1.477218, -153.498641, 0.0), new Point3d(0.77384, -8.021682, -94.0), new Point3d(-64.392137, -145.234375, 0.0), new Point3d(-33.731801, -3.015985, -94.0), new Point3d(-128.935, -119.668008, 0.0), new Point3d(-67.542563, 12.469661, -94.0), new Point3d(-185.4365, -81.474469, 0.0), new Point3d(-97.140859, 35.603637, -94.0), new Point3d(-235.751609, -32.555805, 0.0), new Point3d(-123.498414, 65.233859, -94.0), new Point3d(-275.439625, 22.660475, 0.0), new Point3d(-144.288969, 98.678578, -94.0), new Point3d(-301.2465, 85.400219, 0.0), new Point3d(-157.807906, 136.680281, -94.0), new Point3d(-300.0, 150.0, 0.0), new Point3d(-228.577453, 162.904313, -47.0), new Point3d(-157.154922, 175.808609, -94.0), new Point3d(-103.357523, 247.172063, -47.0), new Point3d(-153.068953, 231.489813, -47.0), new Point3d(-52.078543, 255.621719, -47.0), new Point3d(1.743843, 258.314844, -47.0), new Point3d(55.481707, 255.251438, -47.0), new Point3d(106.507117, 246.431469, -47.0), new Point3d(197.506875, 205.766188, -47.0), new Point3d(153.280156, 231.40125, -47.0), new Point3d(228.577453, 162.904313, -47.0), new Point3d(229.432141, 110.611469, -47.0), new Point3d(209.321781, 59.684586, -47.0), new Point3d(179.514016, 16.204132, -47.0), new Point3d(141.785563, -22.506064, -47.0), new Point3d(51.113715, -73.554266, -47.0), new Point3d(99.154047, -53.076184, -47.0), new Point3d(1.125529, -80.760164, -47.0), new Point3d(-49.061969, -74.12518, -47.0), new Point3d(-98.238781, -53.599176, -47.0), new Point3d(-141.288688, -22.935416, -47.0), new Point3d(-209.864297, 60.669523, -47.0), new Point3d(-179.625016, 16.339027, -47.0), new Point3d(-229.527203, 111.04025, -47.0), new Point3d(0.0, 247.792422, -84.0), new Point3d(35.45952, 245.798125, -84.0), new Point3d(71.015367, 239.395359, -84.0), new Point3d(104.952289, 227.684234, -84.0), new Point3d(136.019484, 207.942281, -84.0), new Point3d(157.154922, 175.808609, -84.0), new Point3d(157.77775, 136.530484, -84.0), new Point3d(143.710984, 97.530469, -84.0), new Point3d(123.041867, 64.626715, -84.0), new Point3d(96.919461, 35.394453, -84.0), new Point3d(67.443461, 12.407895, -84.0), new Point3d(34.616102, -2.748099, -84.0), new Point3d(0.55276, -8.022964, -84.0), new Point3d(-33.624148, -3.048111, -84.0), new Point3d(-67.121539, 12.207951, -84.0), new Point3d(-96.747688, 35.232555, -84.0), new Point3d(-123.226352, 64.87157, -84.0), new Point3d(-144.259, 98.61857, -84.0), new Point3d(-157.924344, 137.268734, -84.0), new Point3d(-157.154922, 175.808609, -84.0), new Point3d(-135.195516, 208.674078, -84.0), new Point3d(-104.054703, 228.091234, -84.0), new Point3d(-70.384797, 239.553859, -84.0), new Point3d(-36.026906, 245.732781, -84.0), new Point3d(0.0, 247.792422, -84.0), new Point3d(0.0, 253.099266, 0.0), new Point3d(64.742059, 250.052203, 0.0), new Point3d(129.659992, 240.269531, 0.0), new Point3d(191.622094, 222.376281, 0.0), new Point3d(248.344641, 192.212875, 0.0), new Point3d(286.93375, 143.116359, 0.0), new Point3d(288.070906, 83.103938, 0.0), new Point3d(262.387781, 23.516443, 0.0), new Point3d(224.650078, -26.756678, 0.0), new Point3d(176.955734, -71.42018, 0.0), new Point3d(123.138398, -106.540977, 0.0), new Point3d(63.202145, -129.69757, 0.0), new Point3d(1.00923, -137.756953, 0.0), new Point3d(-61.391031, -130.155953, 0.0), new Point3d(-122.550633, -106.846461, 0.0), new Point3d(-176.642109, -71.667547, 0.0), new Point3d(-224.986906, -26.382564, 0.0), new Point3d(-263.388344, 25.178932, 0.0), new Point3d(-288.338563, 84.231891, 0.0), new Point3d(-286.93375, 143.116359, 0.0), new Point3d(-246.840234, 193.330969, 0.0), new Point3d(-189.983266, 222.998141, 0.0), new Point3d(-128.508695, 240.511688, 0.0), new Point3d(-65.777992, 249.952375, 0.0), new Point3d(0.0, 253.099266, 0.0), new Point3d(0.0, 247.792422, -84.0), new Point3d(35.45952, 245.798125, -84.0), new Point3d(71.015367, 239.395359, -84.0), new Point3d(104.952289, 227.684234, -84.0), new Point3d(136.019484, 207.942281, -84.0), new Point3d(157.154922, 175.808609, -84.0), new Point3d(157.77775, 136.530484, -84.0), new Point3d(143.710984, 97.530469, -84.0), new Point3d(123.041867, 64.626715, -84.0), new Point3d(96.919461, 35.394453, -84.0), new Point3d(67.443461, 12.407895, -84.0), new Point3d(34.616102, -2.748099, -84.0), new Point3d(0.55276, -8.022964, -84.0), new Point3d(-33.624148, -3.048111, -84.0), new Point3d(-67.121539, 12.207951, -84.0), new Point3d(-96.747688, 35.232555, -84.0), new Point3d(-123.226352, 64.87157, -84.0), new Point3d(-144.259, 98.61857, -84.0), new Point3d(-157.924344, 137.268734, -84.0), new Point3d(-157.154922, 175.808609, -84.0), new Point3d(-135.195516, 208.674078, -84.0), new Point3d(-104.054703, 228.091234, -84.0), new Point3d(-70.384797, 239.553859, -84.0), new Point3d(-36.026906, 245.732781, -84.0) };
				IfcCartesianPointList3D cartesianPointList3D = new IfcCartesianPointList3D(md, points);
				List<CoordIndex> coordIndex = new List<CoordIndex>() { new CoordIndex(28, 2, 29), new CoordIndex(1, 29, 2), new CoordIndex(30, 1, 24), new CoordIndex(29, 1, 30), new CoordIndex(24, 31, 30), new CoordIndex(3, 2, 28), new CoordIndex(5, 4, 27), new CoordIndex(6, 5, 25), new CoordIndex(25, 5, 26), new CoordIndex(4, 28, 27), new CoordIndex(5, 27, 26), new CoordIndex(3, 28, 4), new CoordIndex(23, 32, 31), new CoordIndex(33, 32, 23), new CoordIndex(24, 23, 31), new CoordIndex(34, 22, 21), new CoordIndex(23, 22, 33), new CoordIndex(22, 34, 33), new CoordIndex(21, 20, 35), new CoordIndex(36, 35, 20), new CoordIndex(34, 21, 35), new CoordIndex(37, 36, 19), new CoordIndex(20, 19, 36), new CoordIndex(18, 37, 19), new CoordIndex(7, 6, 48), new CoordIndex(8, 7, 47), new CoordIndex(7, 48, 47), new CoordIndex(8, 47, 46), new CoordIndex(46, 9, 8), new CoordIndex(46, 45, 10), new CoordIndex(11, 10, 45), new CoordIndex(12, 11, 44), new CoordIndex(45, 44, 11), new CoordIndex(10, 9, 46), new CoordIndex(12, 44, 43), new CoordIndex(15, 39, 16), new CoordIndex(40, 39, 15), new CoordIndex(38, 16, 39), new CoordIndex(18, 17, 37), new CoordIndex(16, 38, 17), new CoordIndex(17, 38, 37), new CoordIndex(13, 43, 42), new CoordIndex(12, 43, 13), new CoordIndex(14, 13, 42), new CoordIndex(15, 14, 40), new CoordIndex(14, 41, 40), new CoordIndex(42, 41, 14), new CoordIndex(48, 6, 25), new CoordIndex(50, 72, 49), new CoordIndex(51, 72, 50), new CoordIndex(71, 72, 52), new CoordIndex(51, 52, 72), new CoordIndex(53, 71, 52), new CoordIndex(69, 70, 63), new CoordIndex(71, 54, 70), new CoordIndex(66, 67, 65), new CoordIndex(67, 68, 65), new CoordIndex(68, 69, 64), new CoordIndex(71, 53, 54), new CoordIndex(54, 55, 61), new CoordIndex(55, 56, 61), new CoordIndex(58, 60, 57), new CoordIndex(60, 56, 57), new CoordIndex(59, 60, 58), new CoordIndex(65, 68, 64), new CoordIndex(69, 63, 64), new CoordIndex(62, 63, 70), new CoordIndex(62, 54, 61), new CoordIndex(61, 56, 60), new CoordIndex(62, 70, 54), new CoordIndex(74, 73, 76), new CoordIndex(80, 125, 126), new CoordIndex(126, 76, 78), new CoordIndex(126, 77, 76), new CoordIndex(76, 77, 74), new CoordIndex(82, 127, 125), new CoordIndex(127, 82, 84), new CoordIndex(127, 83, 81), new CoordIndex(125, 81, 79), new CoordIndex(128, 84, 129), new CoordIndex(88, 130, 86), new CoordIndex(92, 131, 90), new CoordIndex(90, 132, 88), new CoordIndex(94, 133, 92), new CoordIndex(96, 134, 94), new CoordIndex(98, 135, 96), new CoordIndex(128, 85, 83), new CoordIndex(77, 75, 74), new CoordIndex(77, 126, 79), new CoordIndex(85, 128, 87), new CoordIndex(87, 129, 89), new CoordIndex(131, 93, 132), new CoordIndex(134, 97, 133), new CoordIndex(97, 134, 99), new CoordIndex(133, 95, 131), new CoordIndex(132, 91, 130), new CoordIndex(135, 98, 136), new CoordIndex(102, 137, 100), new CoordIndex(106, 138, 104), new CoordIndex(104, 139, 102), new CoordIndex(137, 103, 136), new CoordIndex(108, 140, 106), new CoordIndex(138, 107, 139), new CoordIndex(139, 105, 137), new CoordIndex(99, 135, 101), new CoordIndex(141, 110, 112), new CoordIndex(114, 143, 142), new CoordIndex(141, 111, 109), new CoordIndex(110, 141, 140), new CoordIndex(118, 144, 145), new CoordIndex(120, 146, 144), new CoordIndex(116, 145, 143), new CoordIndex(122, 123, 146), new CoordIndex(140, 109, 138), new CoordIndex(111, 141, 142), new CoordIndex(113, 142, 143), new CoordIndex(145, 117, 115), new CoordIndex(146, 121, 119), new CoordIndex(123, 124, 121), new CoordIndex(144, 119, 117), new CoordIndex(148, 173, 172), new CoordIndex(149, 174, 173), new CoordIndex(151, 176, 175), new CoordIndex(152, 177, 176), new CoordIndex(150, 175, 174), new CoordIndex(154, 179, 178), new CoordIndex(155, 180, 179), new CoordIndex(157, 182, 181), new CoordIndex(158, 183, 182), new CoordIndex(156, 181, 180), new CoordIndex(153, 178, 177), new CoordIndex(160, 185, 159), new CoordIndex(161, 186, 160), new CoordIndex(163, 188, 162), new CoordIndex(164, 189, 163), new CoordIndex(162, 187, 161), new CoordIndex(166, 191, 165), new CoordIndex(167, 192, 166), new CoordIndex(169, 194, 168), new CoordIndex(171, 196, 170), new CoordIndex(170, 195, 169), new CoordIndex(168, 193, 167), new CoordIndex(165, 190, 164), new CoordIndex(159, 184, 183), new CoordIndex(217, 216, 215), new CoordIndex(217, 215, 218), new CoordIndex(220, 219, 214), new CoordIndex(215, 219, 218), new CoordIndex(197, 220, 214), new CoordIndex(214, 213, 197), new CoordIndex(219, 215, 214), new CoordIndex(210, 208, 211), new CoordIndex(213, 212, 205), new CoordIndex(212, 211, 207), new CoordIndex(197, 213, 205), new CoordIndex(198, 204, 199), new CoordIndex(200, 199, 203), new CoordIndex(203, 202, 201), new CoordIndex(200, 203, 201), new CoordIndex(203, 199, 204), new CoordIndex(209, 208, 210), new CoordIndex(208, 207, 211), new CoordIndex(206, 212, 207), new CoordIndex(212, 206, 205), new CoordIndex(197, 205, 204), new CoordIndex(197, 204, 198), new CoordIndex(80, 126, 78), new CoordIndex(82, 125, 80), new CoordIndex(127, 84, 128), new CoordIndex(127, 81, 125), new CoordIndex(125, 79, 126), new CoordIndex(84, 86, 129), new CoordIndex(130, 129, 86), new CoordIndex(131, 132, 90), new CoordIndex(132, 130, 88), new CoordIndex(133, 131, 92), new CoordIndex(134, 133, 94), new CoordIndex(135, 134, 96), new CoordIndex(128, 83, 127), new CoordIndex(128, 129, 87), new CoordIndex(129, 130, 89), new CoordIndex(93, 91, 132), new CoordIndex(97, 95, 133), new CoordIndex(134, 135, 99), new CoordIndex(95, 93, 131), new CoordIndex(91, 89, 130), new CoordIndex(98, 100, 136), new CoordIndex(137, 136, 100), new CoordIndex(138, 139, 104), new CoordIndex(139, 137, 102), new CoordIndex(103, 101, 136), new CoordIndex(140, 138, 106), new CoordIndex(107, 105, 139), new CoordIndex(105, 103, 137), new CoordIndex(135, 136, 101), new CoordIndex(141, 112, 142), new CoordIndex(114, 142, 112), new CoordIndex(141, 109, 140), new CoordIndex(110, 140, 108), new CoordIndex(118, 145, 116), new CoordIndex(120, 144, 118), new CoordIndex(116, 143, 114), new CoordIndex(122, 146, 120), new CoordIndex(109, 107, 138), new CoordIndex(111, 142, 113), new CoordIndex(113, 143, 115), new CoordIndex(145, 115, 143), new CoordIndex(146, 119, 144), new CoordIndex(123, 121, 146), new CoordIndex(144, 117, 145), new CoordIndex(148, 172, 147), new CoordIndex(149, 173, 148), new CoordIndex(151, 175, 150), new CoordIndex(152, 176, 151), new CoordIndex(150, 174, 149), new CoordIndex(154, 178, 153), new CoordIndex(155, 179, 154), new CoordIndex(157, 181, 156), new CoordIndex(158, 182, 157), new CoordIndex(156, 180, 155), new CoordIndex(153, 177, 152), new CoordIndex(185, 184, 159), new CoordIndex(186, 185, 160), new CoordIndex(188, 187, 162), new CoordIndex(189, 188, 163), new CoordIndex(187, 186, 161), new CoordIndex(191, 190, 165), new CoordIndex(192, 191, 166), new CoordIndex(194, 193, 168), new CoordIndex(196, 195, 170), new CoordIndex(195, 194, 169), new CoordIndex(193, 192, 167), new CoordIndex(190, 189, 164), new CoordIndex(159, 183, 158) };
				IfcTriangulatedFaceSet triangulatedFaceSet = new IfcTriangulatedFaceSet(md, cartesianPointList3D, null, true, coordIndex, null);
				representationMap = new IfcRepresentationMap(triangulatedFaceSet);
			}

			md.NextObjectRecord = 200;
			IfcMaterial ceramic = new IfcMaterial(md, "Ceramic", "", "");
			ceramic.Associates.GlobalId = "0Pkhszwjv1qRMYyCFg9fjB";
			IfcSanitaryTerminalType sanitaryTerminalType = new IfcSanitaryTerminalType(md, "Wash Hand Basin", IfcSanitaryTerminalTypeEnum.WASHHANDBASIN) { GlobalId = "2Vk5O9OO94lfvLVH2WXKBZ", MaterialSelect = ceramic, RepresentationMaps = new List<IfcRepresentationMap>() { representationMap } };
			sanitaryTerminalType.ObjectTypeOf.GlobalId = "01OIK6g$5EVxvitdj$pQSU";
			IfcElement element = sanitaryTerminalType.GenerateMappedItemElement(building, Plane.WorldXY);
			element.GlobalId = "0dOOwKTsn8I8gwbP3LM1Yz";
		}
Ejemplo n.º 8
0
        internal enum ShapeRep { AdvancedBrep, Brep, Tessellation }         //,CSG, ClosedShell
        internal static void GenerateBasin(ShapeRep shapeRep, STPModelData md, IfcBuilding building)
        {
            md.NextObjectRecord = 500;
            IfcRepresentationMap representationMap = null;

            if (shapeRep == ShapeRep.AdvancedBrep)
            {
                #region advancedBrep
                IfcCartesianPoint cp1 = new IfcCartesianPoint(md, 0.0, 253.099263998677, 0.0);
                cp1.Comments.Add("geometry definition of the advanced brep");
                IfcCartesianPoint cp2 = new IfcCartesianPoint(md, 0.0, 247.792422124388, -83.9999999999991);
                IfcCartesianPoint cp3 = new IfcCartesianPoint(md, 0.0, 268.843232748677, 0.0);
                IfcCartesianPoint cp4 = new IfcCartesianPoint(md, 0.0, 247.792422124388, -93.9999999999991);
                IfcVertexPoint    vp1 = new IfcVertexPoint(cp1), vp2 = new IfcVertexPoint(cp2), vp3 = new IfcVertexPoint(cp3), vp4 = new IfcVertexPoint(cp4);

                IfcEdgeCurve   edgeCurve1 = new IfcEdgeCurve(vp1, vp2, new IfcPolyline(cp1, cp2), true);               //140
                List <Point3d> points3d   = new List <Point3d>()
                {
                    new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991), new Point3d(0.0, -108.13323051355, -83.9999999999991), new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991)
                };
                IfcBSplineCurveWithKnots nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points3d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List <int>()
                {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                }, new List <double>()
                {
                    -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0
                }, IfcKnotType.UNSPECIFIED);
                IfcEdgeCurve   edgeCurve2 = new IfcEdgeCurve(vp2, vp2, nurbsCurve, true);               //149
                List <Point2d> points2d   = new List <Point2d>()
                {
                    new Point2d(-437.751000004175, 168.150654933496), new Point2d(0.0, 295.573568531267), new Point2d(437.751000006541, 168.150654933498), new Point2d(0.0, -290.713822148428), new Point2d(-437.751000004175, 168.150654933496), new Point2d(0.0, 295.573568531267), new Point2d(437.751000006541, 168.150654933498)
                };
                nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points2d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List <int>()
                {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                }, new List <double>()
                {
                    -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0
                }, IfcKnotType.UNSPECIFIED);
                IfcEdgeCurve edgeCurve3 = new IfcEdgeCurve(vp1, vp1, nurbsCurve, true);                 //158
                IfcEdgeCurve edgeCurve4 = new IfcEdgeCurve(vp3, vp4, new IfcPolyline(cp3, cp4), true);  //162
                points3d = new List <Point3d>()
                {
                    new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991), new Point3d(0.0, -108.133230500215, -93.9999999999991), new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991)
                };
                nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points3d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List <int>()
                {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                }, new List <double>()
                {
                    -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0
                }, IfcKnotType.UNSPECIFIED);
                IfcEdgeCurve edgeCurve5 = new IfcEdgeCurve(vp4, vp4, nurbsCurve, true);                 //171
                points2d = new List <Point2d>()
                {
                    new Point2d(457.685108750143, 177.051077752302), new Point2d(0.0, 314.739310246865), new Point2d(-457.685108750141, 177.051077752299), new Point2d(0.0, -318.77998625438), new Point2d(457.685108750143, 177.051077752302), new Point2d(0.0, 314.739310246865), new Point2d(-457.685108750141, 177.051077752299)
                };
                nurbsCurve = new IfcBSplineCurveWithKnots(md, 3, points2d, IfcBSplineCurveForm.UNSPECIFIED, IfcLogicalEnum.TRUE, IfcLogicalEnum.TRUE, new List <int>()
                {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                }, new List <double>()
                {
                    -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0
                }, IfcKnotType.UNSPECIFIED);
                IfcEdgeCurve edgeCurve6 = new IfcEdgeCurve(vp3, vp3, nurbsCurve, true);                 //181

                List <IfcOrientedEdge> orientedEdges = new List <IfcOrientedEdge>();
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve1, true));
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve2, true));
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve1, false));
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve3, true));
                IfcFaceOuterBound      faceOuterBound       = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdges), true);
                List <List <Point3d> > surfaceControlPoints = new List <List <Point3d> >();
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(437.751000006541, 168.150654933498, 0.0), new Point3d(0.0, 295.573568531267, 0.0), new Point3d(-437.751000004175, 168.150654933496, 0.0), new Point3d(0.0, -290.713822148428, 0.0), new Point3d(437.751000006541, 168.150654933498, 0.0), new Point3d(0.0, 295.573568531267, 0.0), new Point3d(-437.751000004175, 168.150654933496, 0.0)
                });
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(371.75340451674, 176.164956423972, -27.9999999999997), new Point3d(0.0, 288.912996848885, -27.9999999999997), new Point3d(-371.753404513767, 176.16495642397, -27.9999999999997), new Point3d(0.0, -229.853624936802, -27.9999999999997), new Point3d(371.75340451674, 176.164956423972, -27.9999999999997), new Point3d(0.0, 288.912996848885, -27.9999999999997), new Point3d(-371.753404513767, 176.16495642397, -27.9999999999997)
                });
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(305.75580902694, 184.179257914445, -55.9999999999994), new Point3d(0.0, 282.252425166504, -55.9999999999994), new Point3d(-305.755809023358, 184.179257914444, -55.9999999999994), new Point3d(0.0, -168.993427725176, -55.9999999999994), new Point3d(305.75580902694, 184.179257914445, -55.9999999999994), new Point3d(0.0, 282.252425166504, -55.9999999999994), new Point3d(-305.755809023358, 184.179257914444, -55.9999999999994)
                });
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991), new Point3d(0.0, -108.13323051355, -83.9999999999991), new Point3d(239.758213537139, 192.193559404919, -83.9999999999991), new Point3d(0.0, 275.591853484122, -83.9999999999991), new Point3d(-239.75821353295, 192.193559404918, -83.9999999999991)
                });
                List <int> uMults = new List <int>()
                {
                    4, 4
                }, vMults = new List <int>()
                {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                };
                List <double> uKnots = new List <double>()
                {
                    0.0, 14.7110308353668
                };
                List <double> vKnots = new List <double>()
                {
                    -7, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0
                };
                IfcBSplineSurfaceWithKnots nurbsSurface = new IfcBSplineSurfaceWithKnots(md, 3, 3, surfaceControlPoints, IfcBSplineSurfaceForm.UNSPECIFIED, IfcLogicalEnum.FALSE, IfcLogicalEnum.TRUE, IfcLogicalEnum.FALSE, uMults, vMults, uKnots, vKnots, IfcKnotType.UNSPECIFIED);
                IfcAdvancedFace            face1        = new IfcAdvancedFace(faceOuterBound, nurbsSurface, false);

                orientedEdges = new List <IfcOrientedEdge>();
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve4, true));
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve5, true));
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve4, false));
                orientedEdges.Add(new IfcOrientedEdge(edgeCurve6, true));
                faceOuterBound       = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdges), true);
                surfaceControlPoints = new List <List <Point3d> >();
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(-457.685108750141, 177.051077752299, 0.0), new Point3d(0.0, 314.739310246865, 0.0), new Point3d(457.685108750143, 177.051077752302, 0.0), new Point3d(0.0, -318.77998625438, 0.0), new Point3d(-457.685108750141, 177.051077752299, 0.0), new Point3d(0.0, 314.739310246865, 0.0), new Point3d(457.685108750143, 177.051077752302, 0.0)
                });
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(-385.042810345109, 182.098571627615, -31.333333333333), new Point3d(0.0, 301.690157997063, -31.333333333333), new Point3d(385.04281034511, 182.098571627617, -31.333333333333), new Point3d(0.0, -248.564401002992, -31.333333333333), new Point3d(-385.042810345109, 182.098571627615, -31.333333333333), new Point3d(0.0, 301.690157997063, -31.333333333333), new Point3d(385.04281034511, 182.098571627617, -31.333333333333)
                });
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(-312.400511940076, 187.146065502931, -62.666666666666), new Point3d(0.0, 288.64100574726, -62.666666666666), new Point3d(312.400511940078, 187.146065502933, -62.666666666666), new Point3d(0.0, -178.348815751603, -62.6666666666661), new Point3d(-312.400511940076, 187.146065502931, -62.666666666666), new Point3d(0.0, 288.64100574726, -62.666666666666), new Point3d(312.400511940078, 187.146065502933, -62.666666666666)
                });
                surfaceControlPoints.Add(new List <Point3d>()
                {
                    new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991), new Point3d(0.0, -108.133230500215, -93.9999999999991), new Point3d(-239.758213535044, 192.193559378247, -93.9999999999991), new Point3d(0.0, 275.591853497458, -93.9999999999991), new Point3d(239.758213535045, 192.193559378248, -93.9999999999991)
                });
                uMults = new List <int>()
                {
                    4, 4
                };
                vMults = new List <int>()
                {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                };
                uKnots = new List <double>()
                {
                    0.0, 15.4213505620632
                };
                vKnots = new List <double>()
                {
                    -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0
                };
                nurbsSurface = new IfcBSplineSurfaceWithKnots(md, 3, 3, surfaceControlPoints, IfcBSplineSurfaceForm.UNSPECIFIED, IfcLogicalEnum.FALSE, IfcLogicalEnum.TRUE, IfcLogicalEnum.FALSE, uMults, vMults, uKnots, vKnots, IfcKnotType.UNSPECIFIED);
                IfcAdvancedFace face2 = new IfcAdvancedFace(faceOuterBound, nurbsSurface, false);

                IfcOrientedEdge orientedEdge = new IfcOrientedEdge(edgeCurve2, false);
                faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdge), true);
                IfcPlane        plane = new IfcPlane(new IfcAxis2Placement3D(cp2, null, null));
                IfcAdvancedFace face3 = new IfcAdvancedFace(faceOuterBound, plane, true);

                orientedEdge   = new IfcOrientedEdge(edgeCurve5, true);
                faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdge), true);
                plane          = new IfcPlane(new IfcAxis2Placement3D(cp4, null, null));
                IfcAdvancedFace face4 = new IfcAdvancedFace(faceOuterBound, plane, false);

                orientedEdge   = new IfcOrientedEdge(edgeCurve6, false);
                faceOuterBound = new IfcFaceOuterBound(new IfcEdgeLoop(orientedEdge), true);
                orientedEdge   = new IfcOrientedEdge(edgeCurve3, false);
                IfcFaceBound facebound = new IfcFaceBound(new IfcEdgeLoop(orientedEdge), true);
                plane = new IfcPlane(new IfcAxis2Placement3D(cp1, null, null));
                IfcAdvancedFace face5 = new IfcAdvancedFace(faceOuterBound, facebound, plane, true);

                IfcAdvancedBrep advancedBrep = new IfcAdvancedBrep(new List <IfcAdvancedFace>()
                {
                    face1, face2, face3, face4, face5
                });
                representationMap = new IfcRepresentationMap(advancedBrep);
                #endregion
            }
            else if (shapeRep == ShapeRep.Brep)
            {
                #region facetedBrep
                List <IfcCartesianPoint> cps = new List <IfcCartesianPoint>();

                List <IfcFace> faces = new List <IfcFace>();

                cps.Add(new IfcCartesianPoint(md, 8.5265128291212E-14, 268.843232748677, 0));
                cps.Add(new IfcCartesianPoint(md, -40.6565545240771, 267.741230885222, 0));
                cps.Add(new IfcCartesianPoint(md, -81.1844472420702, 264.337146165631, 0));
                cps.Add(new IfcCartesianPoint(md, -121.414523219646, 258.379966740374, 0));
                cps.Add(new IfcCartesianPoint(md, -161.084488243579, 249.439282575701, 0));
                cps.Add(new IfcCartesianPoint(md, -199.732402407963, 236.816640911423, 0));
                cps.Add(new IfcCartesianPoint(md, -236.448287386336, 219.398404238099, 0));
                cps.Add(new IfcCartesianPoint(md, -269.269780991348, 195.519340118616, 0));
                cps.Add(new IfcCartesianPoint(md, -294.036921021401, 163.504056083023, 0));
                cps.Add(new IfcCartesianPoint(md, -304.879990220018, 124.598157305706, 0));
                cps.Add(new IfcCartesianPoint(md, -300.744331060112, 84.2991194842604, 0));
                cps.Add(new IfcCartesianPoint(md, -286.871978591032, 46.1280924370721, 0));
                cps.Add(new IfcCartesianPoint(md, -267.00397578777, 10.6705825582408, 0));
                cps.Add(new IfcCartesianPoint(md, -242.91417242145, -22.0789599923818, 0));
                cps.Add(new IfcCartesianPoint(md, -215.49737582355, -52.1038389186614, 0));
                cps.Add(new IfcCartesianPoint(md, -185.233564258487, -79.2577607647334, 0));
                cps.Add(new IfcCartesianPoint(md, -152.394753430662, -103.231127678777, 0));
                cps.Add(new IfcCartesianPoint(md, -117.162752124351, -123.516605031891, 0));
                cps.Add(new IfcCartesianPoint(md, -79.7327064970238, -139.366465926728, 0));
                cps.Add(new IfcCartesianPoint(md, -40.4494524879168, -149.766330003707, 0));
                cps.Add(new IfcCartesianPoint(md, -8.5265128291212E-14, -153.50296491882, 0));
                cps.Add(new IfcCartesianPoint(md, 40.4494508793845, -149.766330296203, 0));
                cps.Add(new IfcCartesianPoint(md, 79.7327043771191, -139.366466661145, 0));
                cps.Add(new IfcCartesianPoint(md, 117.162756918928, -123.516602630764, 0));
                cps.Add(new IfcCartesianPoint(md, 152.394751766558, -103.231128764915, 0));
                cps.Add(new IfcCartesianPoint(md, 185.23356996992, -79.2577561301781, 0));
                cps.Add(new IfcCartesianPoint(md, 215.497373929206, -52.103840795184, 0));
                cps.Add(new IfcCartesianPoint(md, 242.914167878755, -22.078965508489, 0));
                cps.Add(new IfcCartesianPoint(md, 267.003976250216, 10.6705832692101, 0));
                cps.Add(new IfcCartesianPoint(md, 286.871977954697, 46.1280910808867, 0));
                cps.Add(new IfcCartesianPoint(md, 300.744329678325, 84.2991139637225, 0));
                cps.Add(new IfcCartesianPoint(md, 304.879990112863, 124.598158883845, 0));
                cps.Add(new IfcCartesianPoint(md, 294.036920669161, 163.504056764251, 0));
                cps.Add(new IfcCartesianPoint(md, 269.269779973882, 195.519341068674, 0));
                cps.Add(new IfcCartesianPoint(md, 236.44828639794, 219.398404808304, 0));
                cps.Add(new IfcCartesianPoint(md, 199.73240148445, 236.816641271916, 0));
                cps.Add(new IfcCartesianPoint(md, 161.084487568103, 249.439282758701, 0));
                cps.Add(new IfcCartesianPoint(md, 121.414531991753, 258.379965126806, 0));
                cps.Add(new IfcCartesianPoint(md, 81.1844476691385, 264.337146116746, 0));
                cps.Add(new IfcCartesianPoint(md, 40.6565563813857, 267.741230783552, 0));


                IfcPolyloop       polyloop       = new IfcPolyloop(cps.GetRange(0, 40));
                IfcFaceOuterBound faceOuterBound = new IfcFaceOuterBound(polyloop, true);

                cps.Add(new IfcCartesianPoint(md, -2.36369146477955E-09, 253.099263998677, 0));
                cps.Add(new IfcCartesianPoint(md, 38.4274900386849, 252.103548079205, 0));
                cps.Add(new IfcCartesianPoint(md, 76.7439433401587, 249.028666176807, 0));
                cps.Add(new IfcCartesianPoint(md, 114.803789550381, 243.649797844599, 0));
                cps.Add(new IfcCartesianPoint(md, 152.382048016624, 235.580438211911, 0));
                cps.Add(new IfcCartesianPoint(md, 189.083091558087, 224.18969850467, 0));
                cps.Add(new IfcCartesianPoint(md, 224.125137689733, 208.456936531179, 0));
                cps.Add(new IfcCartesianPoint(md, 255.793363304913, 186.795125569967, 0));
                cps.Add(new IfcCartesianPoint(md, 280.260264776878, 157.383008003324, 0));
                cps.Add(new IfcCartesianPoint(md, 291.499069651162, 120.929075349148, 0));
                cps.Add(new IfcCartesianPoint(md, 287.781794186053, 82.8439932251812, 0));
                cps.Add(new IfcCartesianPoint(md, 274.333349777552, 46.8976139888769, 0));
                cps.Add(new IfcCartesianPoint(md, 255.041935323226, 13.6804471549583, 0));
                cps.Add(new IfcCartesianPoint(md, 231.718321168942, -16.8550204261573, 0));
                cps.Add(new IfcCartesianPoint(md, 205.26490842152, -44.72871539005, 0));
                cps.Add(new IfcCartesianPoint(md, 176.16701831263, -69.8307253653909, 0));
                cps.Add(new IfcCartesianPoint(md, 144.705875892003, -91.8966701176456, 0));
                cps.Add(new IfcCartesianPoint(md, 111.075533913924, -110.483174825384, 0));
                cps.Add(new IfcCartesianPoint(md, 75.4792575648176, -124.93688849428, 0));
                cps.Add(new IfcCartesianPoint(md, 38.2480241625981, -134.377886037238, 0));
                cps.Add(new IfcCartesianPoint(md, -1.27897692436818E-13, -137.758996454453, 0));
                cps.Add(new IfcCartesianPoint(md, -38.2480094096726, -134.377888604729, 0));
                cps.Add(new IfcCartesianPoint(md, -75.4792556281902, -124.936889137129, 0));
                cps.Add(new IfcCartesianPoint(md, -111.075539062433, -110.483172351871, 0));
                cps.Add(new IfcCartesianPoint(md, -144.705874376312, -91.8966710674264, 0));
                cps.Add(new IfcCartesianPoint(md, -176.167011118929, -69.8307309751332, 0));
                cps.Add(new IfcCartesianPoint(md, -205.264906834, -44.7287169020584, 0));
                cps.Add(new IfcCartesianPoint(md, -231.718318258428, -16.855023827089, 0));
                cps.Add(new IfcCartesianPoint(md, -255.041934669669, 13.6804461875579, 0));
                cps.Add(new IfcCartesianPoint(md, -274.333348315742, 46.8976109786559, 0));
                cps.Add(new IfcCartesianPoint(md, -287.781793945095, 82.843992280873, 0));
                cps.Add(new IfcCartesianPoint(md, -291.499069558299, 120.929076449465, 0));
                cps.Add(new IfcCartesianPoint(md, -280.260264225365, 157.383008985549, 0));
                cps.Add(new IfcCartesianPoint(md, -255.793362494351, 186.795126279187, 0));
                cps.Add(new IfcCartesianPoint(md, -224.12513653713, 208.45693715988, 0));
                cps.Add(new IfcCartesianPoint(md, -189.083091723532, 224.189698444526, 0));
                cps.Add(new IfcCartesianPoint(md, -152.382036267776, 235.580441242109, 0));
                cps.Add(new IfcCartesianPoint(md, -114.803784949771, 243.649798652405, 0));
                cps.Add(new IfcCartesianPoint(md, -76.7439536078398, 249.028665054834, 0));
                cps.Add(new IfcCartesianPoint(md, -38.4274901357192, 252.103548074371, 0));


                polyloop = new IfcPolyloop(cps.GetRange(40, 40));
                IfcFaceBound faceBound = new IfcFaceBound(polyloop, true);
                faces.Add(new IfcFace(faceOuterBound, faceBound));

                cps.Add(new IfcCartesianPoint(md, 7.105427357601E-14, 247.792422124388, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 22.543570345102, 247.043703986819, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 44.9796137172465, 244.728140008744, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 67.1650892668505, 240.670010701811, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 88.8758496727837, 234.574313720423, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 109.718194276454, 225.983554212619, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 128.945156504883, 214.242543022066, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 145.131083023098, 198.61702521984, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 156.028264873931, 178.980157903609, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 159.834545208795, 156.846549510419, -93.999999999999));
                cps.Add(new IfcCartesianPoint(md, 157.205129966729, 134.492794130245, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 150.333031384556, 113.029267864972, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 140.585417581734, 92.698690766237, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 128.649651812238, 73.5661983153641, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 114.88081683599, 55.7059230027226, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 99.4572081299554, 39.2537668954707, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 82.4557792492348, 24.4401234195301, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 63.9015117223512, 11.6305834057239, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 43.825812852227, 1.38178464649553, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 22.3741376569279, -5.50526474040419, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 1.4210854715202E-14, -8.02430054072738, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -22.3741369000302, -5.50526490804053, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -43.8258109334306, 1.38178384202005, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -63.9015107453348, 11.6305828171828, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -82.4557778416754, 24.4401223202192, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -99.4572071589388, 39.2537659566927, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -114.880815789293, 55.7059217719804, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -128.649650827451, 73.5661969013759, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -140.585419271271, 92.6986938201311, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -150.333030863305, 113.029266577227, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -157.205128832971, 134.492789207233, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -159.834545214161, 156.846549002985, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -156.028266010736, 178.980154672375, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -145.131082712872, 198.617025613766, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -128.945159904117, 214.242540461469, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -109.718192999937, 225.983554847043, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -88.8758510792069, 234.574313243064, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -67.16508882249, 240.670010803143, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -44.9796135673833, 244.728140029868, -93.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -22.5435788308204, 247.043703417137, -93.9999999999991));

                polyloop       = new IfcPolyloop(cps.GetRange(80, 40));
                faceOuterBound = new IfcFaceOuterBound(polyloop, true);
                faces.Add(new IfcFace(faceOuterBound));

                cps.Add(new IfcCartesianPoint(md, -4.18794598999739E-09, 247.792422124388, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -22.5435703494529, 247.043703987136, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -44.9796137218369, 244.728140009905, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -67.1650892718133, 240.670010704167, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -88.8758496782756, 234.574313724111, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -109.718194282579, 225.983554217461, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -128.945156511477, 214.24254302742, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -145.131083029256, 198.617025224586, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -156.028264877734, 178.980157906939, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -159.834545208922, 156.846549512965, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -157.205129964107, 134.492794132934, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -150.333031380544, 113.029267867934, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -140.585417577166, 92.6986907692923, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -128.649651807611, 73.5661983182769, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -114.88081683159, 55.7059230052684, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -99.4572081259275, 39.2537668974612, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -82.45577924561, 24.4401234208308, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -63.9015117190565, 11.6305834062858, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -43.8258128490947, 1.38178464641787, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -22.374137653742, -5.50526474077583, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, -5.6843418860808E-14, -8.02430054072741, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 22.374136903413, -5.50526490696816, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 43.8258109365215, 1.38178384447853, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 63.9015107478721, 11.6305828210529, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 82.4557778435065, 24.4401223253757, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 99.4572071600111, 39.2537659629489, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 114.880815789634, 55.7059217791287, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 128.64965082716, 73.5661969092022, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 140.585419270523, 92.6986938284213, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 150.333030862371, 113.029266585776, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 157.205128832256, 134.492789215875, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 159.834545214197, 156.846549011699, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 156.028266011557, 178.980154681359, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 145.131082713423, 198.617025622727, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 128.945159903547, 214.242540469453, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 109.718192998164, 225.983554853335, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 88.8758510764901, 234.574313247461, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 67.1650888191183, 240.67001080579, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 44.9796135636075, 244.728140031113, -83.9999999999991));
                cps.Add(new IfcCartesianPoint(md, 22.5435788267922, 247.043703417465, -83.9999999999991));


                polyloop       = new IfcPolyloop(cps.GetRange(120, 40));
                faceOuterBound = new IfcFaceOuterBound(polyloop, true);
                faces.Add(new IfcFace(faceOuterBound));

                for (int icounter = 0; icounter < 40; icounter++)
                {
                    polyloop       = new IfcPolyloop(cps[icounter == 39 ? 0 : icounter + 1], cps[icounter], cps[icounter == 0 ? 80 : 120 - icounter]);
                    faceOuterBound = new IfcFaceOuterBound(polyloop, true);
                    faces.Add(new IfcFace(faceOuterBound));
                    polyloop       = new IfcPolyloop(cps[80 + (icounter == 39 ? 0 : icounter + 1)], cps[80 + icounter], cps[icounter == 0 ? 0 : 40 - icounter]);
                    faceOuterBound = new IfcFaceOuterBound(polyloop, true);
                    faces.Add(new IfcFace(faceOuterBound));

                    polyloop       = new IfcPolyloop(cps[40 + (icounter == 39 ? 0 : icounter + 1)], cps[40 + icounter], cps[icounter == 0 ? 120 : 160 - icounter]);
                    faceOuterBound = new IfcFaceOuterBound(polyloop, true);
                    faces.Add(new IfcFace(faceOuterBound));
                    polyloop       = new IfcPolyloop(cps[120 + (icounter == 39 ? 0 : icounter + 1)], cps[120 + icounter], cps[icounter == 0 ? 40 : 80 - icounter]);
                    faceOuterBound = new IfcFaceOuterBound(polyloop, true);
                    faces.Add(new IfcFace(faceOuterBound));
                }

                IfcClosedShell closedShell = new IfcClosedShell(faces);
                IfcFacetedBrep facetedBrep = new IfcFacetedBrep(closedShell);
                representationMap = new IfcRepresentationMap(facetedBrep);
                #endregion
            }
            else if (shapeRep == ShapeRep.Tessellation)
            {
                List <Point3d> points = new List <Point3d>()
                {
                    new Point3d(-300.0, 150.0, 0.0), new Point3d(-260.012578, 202.771984, 0.0), new Point3d(-200.897703, 235.427328, 0.0), new Point3d(-135.653172, 254.960516, 0.0), new Point3d(-68.351281, 265.485063, 0.0), new Point3d(2.288734, 268.839531, 0.0), new Point3d(72.81782, 265.023844, 0.0), new Point3d(139.786906, 254.038063, 0.0), new Point3d(201.174906, 235.317031, 0.0), new Point3d(259.220938, 203.387031, 0.0), new Point3d(300.0, 150.0, 0.0), new Point3d(301.12175, 84.866148, 0.0), new Point3d(274.727594, 21.433672, 0.0), new Point3d(235.605922, -32.723826, 0.0), new Point3d(186.088641, -80.939688, 0.0), new Point3d(130.136258, -119.016594, 0.0), new Point3d(67.084977, -144.523266, 0.0), new Point3d(1.477218, -153.498641, 0.0), new Point3d(-64.392137, -145.234375, 0.0), new Point3d(-128.935, -119.668008, 0.0), new Point3d(-185.4365, -81.474469, 0.0), new Point3d(-235.751609, -32.555805, 0.0), new Point3d(-275.439625, 22.660475, 0.0), new Point3d(-301.2465, 85.400219, 0.0), new Point3d(0.0, 253.099266, 0.0), new Point3d(-65.777992, 249.952375, 0.0), new Point3d(-128.508695, 240.511688, 0.0), new Point3d(-189.983266, 222.998141, 0.0), new Point3d(-246.840234, 193.330969, 0.0), new Point3d(-286.93375, 143.116359, 0.0), new Point3d(-288.338563, 84.231891, 0.0), new Point3d(-263.388344, 25.178932, 0.0), new Point3d(-224.986906, -26.382564, 0.0), new Point3d(-176.642109, -71.667547, 0.0), new Point3d(-122.550633, -106.846461, 0.0), new Point3d(-61.391031, -130.155953, 0.0), new Point3d(1.00923, -137.756953, 0.0), new Point3d(63.202145, -129.69757, 0.0), new Point3d(123.138398, -106.540977, 0.0), new Point3d(176.955734, -71.42018, 0.0), new Point3d(224.650078, -26.756678, 0.0), new Point3d(262.387781, 23.516443, 0.0), new Point3d(288.070906, 83.103938, 0.0), new Point3d(286.93375, 143.116359, 0.0), new Point3d(248.344641, 192.212875, 0.0), new Point3d(191.622094, 222.376281, 0.0), new Point3d(129.659992, 240.269531, 0.0), new Point3d(64.742059, 250.052203, 0.0), new Point3d(-157.154922, 175.808609, -94.0), new Point3d(-136.207516, 207.772813, -94.0), new Point3d(-105.240203, 227.552281, -94.0), new Point3d(-71.061875, 239.383609, -94.0), new Point3d(-35.805801, 245.758375, -94.0), new Point3d(1.198953, 247.790172, -94.0), new Point3d(38.145594, 245.479016, -94.0), new Point3d(73.227336, 238.824875, -94.0), new Point3d(105.385414, 227.485469, -94.0), new Point3d(135.792813, 208.145344, -94.0), new Point3d(157.154922, 175.808609, -94.0), new Point3d(157.742547, 136.356797, -94.0), new Point3d(143.915969, 97.9355, -94.0), new Point3d(123.422102, 65.13209, -94.0), new Point3d(97.482477, 35.927559, -94.0), new Point3d(68.171844, 12.864227, -94.0), new Point3d(35.142449, -2.585266, -94.0), new Point3d(0.77384, -8.021682, -94.0), new Point3d(-33.731801, -3.015985, -94.0), new Point3d(-67.542563, 12.469661, -94.0), new Point3d(-97.140859, 35.603637, -94.0), new Point3d(-123.498414, 65.233859, -94.0), new Point3d(-144.288969, 98.678578, -94.0), new Point3d(-157.807906, 136.680281, -94.0), new Point3d(-300.0, 150.0, 0.0), new Point3d(-228.577453, 162.904313, -47.0), new Point3d(-157.154922, 175.808609, -94.0), new Point3d(-260.012578, 202.771984, 0.0), new Point3d(-136.207516, 207.772813, -94.0), new Point3d(-200.897703, 235.427328, 0.0), new Point3d(-105.240203, 227.552281, -94.0), new Point3d(-135.653172, 254.960516, 0.0), new Point3d(-71.061875, 239.383609, -94.0), new Point3d(-68.351281, 265.485063, 0.0), new Point3d(-35.805801, 245.758375, -94.0), new Point3d(2.288734, 268.839531, 0.0), new Point3d(1.198953, 247.790172, -94.0), new Point3d(72.81782, 265.023844, 0.0), new Point3d(38.145594, 245.479016, -94.0), new Point3d(139.786906, 254.038063, 0.0), new Point3d(73.227336, 238.824875, -94.0), new Point3d(201.174906, 235.317031, 0.0), new Point3d(105.385414, 227.485469, -94.0), new Point3d(259.220938, 203.387031, 0.0), new Point3d(135.792813, 208.145344, -94.0), new Point3d(300.0, 150.0, 0.0), new Point3d(157.154922, 175.808609, -94.0), new Point3d(301.12175, 84.866148, 0.0), new Point3d(157.742547, 136.356797, -94.0), new Point3d(274.727594, 21.433672, 0.0), new Point3d(143.915969, 97.9355, -94.0), new Point3d(235.605922, -32.723826, 0.0), new Point3d(123.422102, 65.13209, -94.0), new Point3d(186.088641, -80.939688, 0.0), new Point3d(97.482477, 35.927559, -94.0), new Point3d(130.136258, -119.016594, 0.0), new Point3d(68.171844, 12.864227, -94.0), new Point3d(67.084977, -144.523266, 0.0), new Point3d(35.142449, -2.585266, -94.0), new Point3d(1.477218, -153.498641, 0.0), new Point3d(0.77384, -8.021682, -94.0), new Point3d(-64.392137, -145.234375, 0.0), new Point3d(-33.731801, -3.015985, -94.0), new Point3d(-128.935, -119.668008, 0.0), new Point3d(-67.542563, 12.469661, -94.0), new Point3d(-185.4365, -81.474469, 0.0), new Point3d(-97.140859, 35.603637, -94.0), new Point3d(-235.751609, -32.555805, 0.0), new Point3d(-123.498414, 65.233859, -94.0), new Point3d(-275.439625, 22.660475, 0.0), new Point3d(-144.288969, 98.678578, -94.0), new Point3d(-301.2465, 85.400219, 0.0), new Point3d(-157.807906, 136.680281, -94.0), new Point3d(-300.0, 150.0, 0.0), new Point3d(-228.577453, 162.904313, -47.0), new Point3d(-157.154922, 175.808609, -94.0), new Point3d(-103.357523, 247.172063, -47.0), new Point3d(-153.068953, 231.489813, -47.0), new Point3d(-52.078543, 255.621719, -47.0), new Point3d(1.743843, 258.314844, -47.0), new Point3d(55.481707, 255.251438, -47.0), new Point3d(106.507117, 246.431469, -47.0), new Point3d(197.506875, 205.766188, -47.0), new Point3d(153.280156, 231.40125, -47.0), new Point3d(228.577453, 162.904313, -47.0), new Point3d(229.432141, 110.611469, -47.0), new Point3d(209.321781, 59.684586, -47.0), new Point3d(179.514016, 16.204132, -47.0), new Point3d(141.785563, -22.506064, -47.0), new Point3d(51.113715, -73.554266, -47.0), new Point3d(99.154047, -53.076184, -47.0), new Point3d(1.125529, -80.760164, -47.0), new Point3d(-49.061969, -74.12518, -47.0), new Point3d(-98.238781, -53.599176, -47.0), new Point3d(-141.288688, -22.935416, -47.0), new Point3d(-209.864297, 60.669523, -47.0), new Point3d(-179.625016, 16.339027, -47.0), new Point3d(-229.527203, 111.04025, -47.0), new Point3d(0.0, 247.792422, -84.0), new Point3d(35.45952, 245.798125, -84.0), new Point3d(71.015367, 239.395359, -84.0), new Point3d(104.952289, 227.684234, -84.0), new Point3d(136.019484, 207.942281, -84.0), new Point3d(157.154922, 175.808609, -84.0), new Point3d(157.77775, 136.530484, -84.0), new Point3d(143.710984, 97.530469, -84.0), new Point3d(123.041867, 64.626715, -84.0), new Point3d(96.919461, 35.394453, -84.0), new Point3d(67.443461, 12.407895, -84.0), new Point3d(34.616102, -2.748099, -84.0), new Point3d(0.55276, -8.022964, -84.0), new Point3d(-33.624148, -3.048111, -84.0), new Point3d(-67.121539, 12.207951, -84.0), new Point3d(-96.747688, 35.232555, -84.0), new Point3d(-123.226352, 64.87157, -84.0), new Point3d(-144.259, 98.61857, -84.0), new Point3d(-157.924344, 137.268734, -84.0), new Point3d(-157.154922, 175.808609, -84.0), new Point3d(-135.195516, 208.674078, -84.0), new Point3d(-104.054703, 228.091234, -84.0), new Point3d(-70.384797, 239.553859, -84.0), new Point3d(-36.026906, 245.732781, -84.0), new Point3d(0.0, 247.792422, -84.0), new Point3d(0.0, 253.099266, 0.0), new Point3d(64.742059, 250.052203, 0.0), new Point3d(129.659992, 240.269531, 0.0), new Point3d(191.622094, 222.376281, 0.0), new Point3d(248.344641, 192.212875, 0.0), new Point3d(286.93375, 143.116359, 0.0), new Point3d(288.070906, 83.103938, 0.0), new Point3d(262.387781, 23.516443, 0.0), new Point3d(224.650078, -26.756678, 0.0), new Point3d(176.955734, -71.42018, 0.0), new Point3d(123.138398, -106.540977, 0.0), new Point3d(63.202145, -129.69757, 0.0), new Point3d(1.00923, -137.756953, 0.0), new Point3d(-61.391031, -130.155953, 0.0), new Point3d(-122.550633, -106.846461, 0.0), new Point3d(-176.642109, -71.667547, 0.0), new Point3d(-224.986906, -26.382564, 0.0), new Point3d(-263.388344, 25.178932, 0.0), new Point3d(-288.338563, 84.231891, 0.0), new Point3d(-286.93375, 143.116359, 0.0), new Point3d(-246.840234, 193.330969, 0.0), new Point3d(-189.983266, 222.998141, 0.0), new Point3d(-128.508695, 240.511688, 0.0), new Point3d(-65.777992, 249.952375, 0.0), new Point3d(0.0, 253.099266, 0.0), new Point3d(0.0, 247.792422, -84.0), new Point3d(35.45952, 245.798125, -84.0), new Point3d(71.015367, 239.395359, -84.0), new Point3d(104.952289, 227.684234, -84.0), new Point3d(136.019484, 207.942281, -84.0), new Point3d(157.154922, 175.808609, -84.0), new Point3d(157.77775, 136.530484, -84.0), new Point3d(143.710984, 97.530469, -84.0), new Point3d(123.041867, 64.626715, -84.0), new Point3d(96.919461, 35.394453, -84.0), new Point3d(67.443461, 12.407895, -84.0), new Point3d(34.616102, -2.748099, -84.0), new Point3d(0.55276, -8.022964, -84.0), new Point3d(-33.624148, -3.048111, -84.0), new Point3d(-67.121539, 12.207951, -84.0), new Point3d(-96.747688, 35.232555, -84.0), new Point3d(-123.226352, 64.87157, -84.0), new Point3d(-144.259, 98.61857, -84.0), new Point3d(-157.924344, 137.268734, -84.0), new Point3d(-157.154922, 175.808609, -84.0), new Point3d(-135.195516, 208.674078, -84.0), new Point3d(-104.054703, 228.091234, -84.0), new Point3d(-70.384797, 239.553859, -84.0), new Point3d(-36.026906, 245.732781, -84.0)
                };
                IfcCartesianPointList3D cartesianPointList3D = new IfcCartesianPointList3D(md, points);
                List <CoordIndex>       coordIndex           = new List <CoordIndex>()
                {
                    new CoordIndex(28, 2, 29), new CoordIndex(1, 29, 2), new CoordIndex(30, 1, 24), new CoordIndex(29, 1, 30), new CoordIndex(24, 31, 30), new CoordIndex(3, 2, 28), new CoordIndex(5, 4, 27), new CoordIndex(6, 5, 25), new CoordIndex(25, 5, 26), new CoordIndex(4, 28, 27), new CoordIndex(5, 27, 26), new CoordIndex(3, 28, 4), new CoordIndex(23, 32, 31), new CoordIndex(33, 32, 23), new CoordIndex(24, 23, 31), new CoordIndex(34, 22, 21), new CoordIndex(23, 22, 33), new CoordIndex(22, 34, 33), new CoordIndex(21, 20, 35), new CoordIndex(36, 35, 20), new CoordIndex(34, 21, 35), new CoordIndex(37, 36, 19), new CoordIndex(20, 19, 36), new CoordIndex(18, 37, 19), new CoordIndex(7, 6, 48), new CoordIndex(8, 7, 47), new CoordIndex(7, 48, 47), new CoordIndex(8, 47, 46), new CoordIndex(46, 9, 8), new CoordIndex(46, 45, 10), new CoordIndex(11, 10, 45), new CoordIndex(12, 11, 44), new CoordIndex(45, 44, 11), new CoordIndex(10, 9, 46), new CoordIndex(12, 44, 43), new CoordIndex(15, 39, 16), new CoordIndex(40, 39, 15), new CoordIndex(38, 16, 39), new CoordIndex(18, 17, 37), new CoordIndex(16, 38, 17), new CoordIndex(17, 38, 37), new CoordIndex(13, 43, 42), new CoordIndex(12, 43, 13), new CoordIndex(14, 13, 42), new CoordIndex(15, 14, 40), new CoordIndex(14, 41, 40), new CoordIndex(42, 41, 14), new CoordIndex(48, 6, 25), new CoordIndex(50, 72, 49), new CoordIndex(51, 72, 50), new CoordIndex(71, 72, 52), new CoordIndex(51, 52, 72), new CoordIndex(53, 71, 52), new CoordIndex(69, 70, 63), new CoordIndex(71, 54, 70), new CoordIndex(66, 67, 65), new CoordIndex(67, 68, 65), new CoordIndex(68, 69, 64), new CoordIndex(71, 53, 54), new CoordIndex(54, 55, 61), new CoordIndex(55, 56, 61), new CoordIndex(58, 60, 57), new CoordIndex(60, 56, 57), new CoordIndex(59, 60, 58), new CoordIndex(65, 68, 64), new CoordIndex(69, 63, 64), new CoordIndex(62, 63, 70), new CoordIndex(62, 54, 61), new CoordIndex(61, 56, 60), new CoordIndex(62, 70, 54), new CoordIndex(74, 73, 76), new CoordIndex(80, 125, 126), new CoordIndex(126, 76, 78), new CoordIndex(126, 77, 76), new CoordIndex(76, 77, 74), new CoordIndex(82, 127, 125), new CoordIndex(127, 82, 84), new CoordIndex(127, 83, 81), new CoordIndex(125, 81, 79), new CoordIndex(128, 84, 129), new CoordIndex(88, 130, 86), new CoordIndex(92, 131, 90), new CoordIndex(90, 132, 88), new CoordIndex(94, 133, 92), new CoordIndex(96, 134, 94), new CoordIndex(98, 135, 96), new CoordIndex(128, 85, 83), new CoordIndex(77, 75, 74), new CoordIndex(77, 126, 79), new CoordIndex(85, 128, 87), new CoordIndex(87, 129, 89), new CoordIndex(131, 93, 132), new CoordIndex(134, 97, 133), new CoordIndex(97, 134, 99), new CoordIndex(133, 95, 131), new CoordIndex(132, 91, 130), new CoordIndex(135, 98, 136), new CoordIndex(102, 137, 100), new CoordIndex(106, 138, 104), new CoordIndex(104, 139, 102), new CoordIndex(137, 103, 136), new CoordIndex(108, 140, 106), new CoordIndex(138, 107, 139), new CoordIndex(139, 105, 137), new CoordIndex(99, 135, 101), new CoordIndex(141, 110, 112), new CoordIndex(114, 143, 142), new CoordIndex(141, 111, 109), new CoordIndex(110, 141, 140), new CoordIndex(118, 144, 145), new CoordIndex(120, 146, 144), new CoordIndex(116, 145, 143), new CoordIndex(122, 123, 146), new CoordIndex(140, 109, 138), new CoordIndex(111, 141, 142), new CoordIndex(113, 142, 143), new CoordIndex(145, 117, 115), new CoordIndex(146, 121, 119), new CoordIndex(123, 124, 121), new CoordIndex(144, 119, 117), new CoordIndex(148, 173, 172), new CoordIndex(149, 174, 173), new CoordIndex(151, 176, 175), new CoordIndex(152, 177, 176), new CoordIndex(150, 175, 174), new CoordIndex(154, 179, 178), new CoordIndex(155, 180, 179), new CoordIndex(157, 182, 181), new CoordIndex(158, 183, 182), new CoordIndex(156, 181, 180), new CoordIndex(153, 178, 177), new CoordIndex(160, 185, 159), new CoordIndex(161, 186, 160), new CoordIndex(163, 188, 162), new CoordIndex(164, 189, 163), new CoordIndex(162, 187, 161), new CoordIndex(166, 191, 165), new CoordIndex(167, 192, 166), new CoordIndex(169, 194, 168), new CoordIndex(171, 196, 170), new CoordIndex(170, 195, 169), new CoordIndex(168, 193, 167), new CoordIndex(165, 190, 164), new CoordIndex(159, 184, 183), new CoordIndex(217, 216, 215), new CoordIndex(217, 215, 218), new CoordIndex(220, 219, 214), new CoordIndex(215, 219, 218), new CoordIndex(197, 220, 214), new CoordIndex(214, 213, 197), new CoordIndex(219, 215, 214), new CoordIndex(210, 208, 211), new CoordIndex(213, 212, 205), new CoordIndex(212, 211, 207), new CoordIndex(197, 213, 205), new CoordIndex(198, 204, 199), new CoordIndex(200, 199, 203), new CoordIndex(203, 202, 201), new CoordIndex(200, 203, 201), new CoordIndex(203, 199, 204), new CoordIndex(209, 208, 210), new CoordIndex(208, 207, 211), new CoordIndex(206, 212, 207), new CoordIndex(212, 206, 205), new CoordIndex(197, 205, 204), new CoordIndex(197, 204, 198), new CoordIndex(80, 126, 78), new CoordIndex(82, 125, 80), new CoordIndex(127, 84, 128), new CoordIndex(127, 81, 125), new CoordIndex(125, 79, 126), new CoordIndex(84, 86, 129), new CoordIndex(130, 129, 86), new CoordIndex(131, 132, 90), new CoordIndex(132, 130, 88), new CoordIndex(133, 131, 92), new CoordIndex(134, 133, 94), new CoordIndex(135, 134, 96), new CoordIndex(128, 83, 127), new CoordIndex(128, 129, 87), new CoordIndex(129, 130, 89), new CoordIndex(93, 91, 132), new CoordIndex(97, 95, 133), new CoordIndex(134, 135, 99), new CoordIndex(95, 93, 131), new CoordIndex(91, 89, 130), new CoordIndex(98, 100, 136), new CoordIndex(137, 136, 100), new CoordIndex(138, 139, 104), new CoordIndex(139, 137, 102), new CoordIndex(103, 101, 136), new CoordIndex(140, 138, 106), new CoordIndex(107, 105, 139), new CoordIndex(105, 103, 137), new CoordIndex(135, 136, 101), new CoordIndex(141, 112, 142), new CoordIndex(114, 142, 112), new CoordIndex(141, 109, 140), new CoordIndex(110, 140, 108), new CoordIndex(118, 145, 116), new CoordIndex(120, 144, 118), new CoordIndex(116, 143, 114), new CoordIndex(122, 146, 120), new CoordIndex(109, 107, 138), new CoordIndex(111, 142, 113), new CoordIndex(113, 143, 115), new CoordIndex(145, 115, 143), new CoordIndex(146, 119, 144), new CoordIndex(123, 121, 146), new CoordIndex(144, 117, 145), new CoordIndex(148, 172, 147), new CoordIndex(149, 173, 148), new CoordIndex(151, 175, 150), new CoordIndex(152, 176, 151), new CoordIndex(150, 174, 149), new CoordIndex(154, 178, 153), new CoordIndex(155, 179, 154), new CoordIndex(157, 181, 156), new CoordIndex(158, 182, 157), new CoordIndex(156, 180, 155), new CoordIndex(153, 177, 152), new CoordIndex(185, 184, 159), new CoordIndex(186, 185, 160), new CoordIndex(188, 187, 162), new CoordIndex(189, 188, 163), new CoordIndex(187, 186, 161), new CoordIndex(191, 190, 165), new CoordIndex(192, 191, 166), new CoordIndex(194, 193, 168), new CoordIndex(196, 195, 170), new CoordIndex(195, 194, 169), new CoordIndex(193, 192, 167), new CoordIndex(190, 189, 164), new CoordIndex(159, 183, 158)
                };
                IfcTriangulatedFaceSet triangulatedFaceSet = new IfcTriangulatedFaceSet(md, cartesianPointList3D, null, true, coordIndex, null);
                representationMap = new IfcRepresentationMap(triangulatedFaceSet);
            }

            md.NextObjectRecord = 200;
            IfcMaterial ceramic = new IfcMaterial(md, "Ceramic", "", "");
            ceramic.Associates.GlobalId = "0Pkhszwjv1qRMYyCFg9fjB";
            IfcSanitaryTerminalType sanitaryTerminalType = new IfcSanitaryTerminalType(md, new IfcElemTypeParams("2Vk5O9OO94lfvLVH2WXKBZ", "Wash Hand Basin", "", "", ""), ceramic, representationMap, null, IfcSanitaryTerminalTypeEnum.WASHHANDBASIN);
            sanitaryTerminalType.ObjectTypeOf.GlobalId = "01OIK6g$5EVxvitdj$pQSU";
            sanitaryTerminalType.GenerateMappedItemElement(building, Plane.WorldXY, new IfcElemParams("0dOOwKTsn8I8gwbP3LM1Yz", "", "", "", ""));
        }
Ejemplo n.º 9
0
        public static int Main(string[] args)
        {
            var returnMessage      = (int)ExitCode.Success;
            var outputElements     = new List <JsonIfcElement>();
            var pathSource         = string.Empty;
            var pathDest           = string.Empty;
            var activeComptactJson = true;
            var readVersion        = false;
            var activeFullJson     = false;
            //var SCALE = 1.0;
            var context = new JsonConversionContext();
            JsonProjectIfcElement newProject = null;

            try
            {
                foreach (string arg in args)
                {
                    if (arg.ToLower().Trim() == "--version")
                    {
                        readVersion = true;
                    }
                    if (arg.ToLower().Trim() == "--indented")
                    {
                        activeComptactJson = false;
                    }
                    if (arg.ToLower().Trim() == "--full")
                    {
                        activeFullJson = true;
                    }
                    if (arg.Substring(0, 2) != "--" && pathSource != string.Empty && pathDest == string.Empty)
                    {
                        pathDest = arg;
                    }
                    if (arg.Substring(0, 2) != "--" && pathSource == string.Empty)
                    {
                        pathSource = arg;
                    }
                }

                if (readVersion)
                {
                    var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                    Console.WriteLine($"1. ConvertIfc2Json : {version}{Environment.NewLine}(.Net version {typeof(string).Assembly.ImageRuntimeVersion})");
                    return(returnMessage);
                }



                if (File.Exists(pathSource))
                {
                    if (pathDest == string.Empty)
                    {
                        pathDest = pathSource + ".json";
                    }
                    var        db = new DatabaseIfc();
                    IfcProject project;
                    var        projectId = "";
                    var        sites     = new List <IfcSite>();
                    var        buildings = new List <IfcBuilding>();

                    try
                    {
                        db      = new DatabaseIfc(pathSource);
                        project = db.Project;
                        sites   = project.Extract <IfcSite>();



                        // IFC Project
                        try
                        {
                            if (project.GlobalId != null)
                            {
                                // REVIEW ne semble pas servir
                                //foreach (var unit in project.UnitsInContext.Units)
                                //{
                                //    var u = project.UnitsInContext.Extract<IfcSIUnit>();
                                //    // Console.WriteLine("2." + unit.StepClassName);
                                //}

                                // Computing the json conversion scale from current Geogym project
                                context.SCALE = project.GetJsonConversionScale();
                                projectId     = project.GlobalId;
                            }

                            outputElements.Add(newProject = new JsonProjectIfcElement(project));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("3. Element read error " + ex.Message);
                            returnMessage = (int)ExitCode.UnknownError;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("31. Write file : " + ex.Message);
                        returnMessage = (int)ExitCode.InvalidFile;
                    }

                    // IFC Site
                    foreach (var site in sites)
                    {
                        try
                        {
                            if (site.GlobalId != null)
                            {
                                var newSite = new JsonSiteIfcElement(site, newProject, context);
                                outputElements.Add(newSite);

                                // IFC Building
                                buildings = site.Extract <IfcBuilding>();
                                foreach (var building in buildings)
                                {
                                    var newBuildind = new JsonBuildingIfcElement(building, newSite, context); // REVIEW shouldn't create this unused instance if global id is null
                                    if (building.GlobalId != null)
                                    {
                                        outputElements.Add(newBuildind);
                                    }

                                    // IFC Building Storey // Levels
                                    var buildingStoreys = building.Extract <IfcBuildingStorey>();
                                    foreach (var buildingStorey in buildingStoreys)
                                    {
                                        var storeyElement = new JsonStoreyIfcElement(buildingStorey, newBuildind, context);
                                        outputElements.Add(storeyElement);


                                        // IFC Space // Rooms
                                        var spaces = buildingStorey.Extract <IfcSpace>();

                                        // Check IfcProduct Ids
                                        var productsIds    = new List <string>();
                                        var productCounter = 0;

                                        // IfcProduct
                                        var products = buildingStorey.Extract <IfcProduct>();
                                        foreach (var product in products)
                                        {
                                            try
                                            {
                                                if (product.GlobalId != null)
                                                {
                                                    var newElementProd = new JsonProductIfcElement(product, storeyElement, context);
                                                    var spaceCounter   = 0;

                                                    // Link to the Space
                                                    foreach (var space in spaces)
                                                    {
                                                        try
                                                        {
                                                            // REVIEW = LatestOrDefault
                                                            // IfcSpace
                                                            if (space.GlobalId == product.GlobalId)
                                                            {
                                                                try
                                                                {
                                                                    newElementProd.userData.name = space.LongName;
                                                                }
                                                                catch (NotSupportedException exEncode)
                                                                {
                                                                    newElementProd.userData.name = space.Name;
                                                                    Console.WriteLine("15. Space Name read error (id: " + space.GlobalId + ") " + exEncode.Message); // returnMessage = (int)ExitCode.NodataIsAvailableForEncoding;
                                                                }
                                                                catch (System.Exception ex)
                                                                {
                                                                    Console.WriteLine("29. Space Name LongName read error" + ex.Message);
                                                                }

                                                                newElementProd.userData.pset.Add("number", space.Name);

                                                                // Create boundary
                                                                geoGeometry geom = new geoGeometry();
                                                                IList <IList <IList <double> > > coords = new List <IList <IList <double> > >();
                                                                Dictionary <string, string>      props  = new Dictionary <string, string>();
                                                                string height    = "0.0";
                                                                string elevation = "0.0";


                                                                // Representation
                                                                if (space.Representation.Representations.Count > 0)
                                                                {
                                                                    foreach (IfcRepresentationItem item in space.Representation.Representations[0].Items)
                                                                    {
                                                                        try
                                                                        {
                                                                            if (item.StepClassName == "IfcExtrudedAreaSolid")
                                                                            {
                                                                                IfcExtrudedAreaSolid areaSolid = item as IfcExtrudedAreaSolid;
                                                                                IfcAxis2Placement3D  pos       = areaSolid.Position;
                                                                                Point3D loc = new Point3D(pos.Location.Coordinates[0], pos.Location.Coordinates[1], pos.Location.Coordinates[2]);
                                                                                height    = (areaSolid.Depth / context.SCALE).ToString();
                                                                                elevation = (buildingStorey.Elevation / context.SCALE).ToString();

                                                                                if (areaSolid.SweptArea.StepClassName == "IfcArbitraryClosedProfileDef")
                                                                                { // Polyline
                                                                                    IfcArbitraryClosedProfileDef arbitraryClosedProfiles = areaSolid.SweptArea as IfcArbitraryClosedProfileDef;
                                                                                    IList <IList <double> >      polyExt = new List <IList <double> >();

                                                                                    if (arbitraryClosedProfiles.OuterCurve.StepClassName == "IfcIndexedPolyCurve")
                                                                                    {
                                                                                        IfcIndexedPolyCurve     outerCurve = arbitraryClosedProfiles.OuterCurve as IfcIndexedPolyCurve;
                                                                                        IfcCartesianPointList2D points     = outerCurve.Points as IfcCartesianPointList2D;
                                                                                        foreach (double[] pts in points.CoordList)
                                                                                        {
                                                                                            if (pts.Length >= 2)
                                                                                            {
                                                                                                try
                                                                                                {
                                                                                                    IList <double> xy = new List <double>();
                                                                                                    xy.Add(pts[0] / context.SCALE);
                                                                                                    xy.Add(pts[1] / context.SCALE);
                                                                                                    polyExt.Add(xy);
                                                                                                }
                                                                                                catch (System.Exception exTransf)
                                                                                                {
                                                                                                    Console.WriteLine("6." + exTransf.Message);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        List <IfcPolyline> poly = arbitraryClosedProfiles.OuterCurve.Extract <IfcPolyline>();

                                                                                        if (poly.Count > 0 && poly[0].Points.Count > 0)
                                                                                        {
                                                                                            foreach (IfcCartesianPoint pt in poly[0].Points)
                                                                                            {
                                                                                                if (pt.Coordinates.Count >= 2)
                                                                                                {
                                                                                                    try
                                                                                                    {
                                                                                                        IList <double> xy = new List <double>();
                                                                                                        xy.Add(pt.Coordinates[0] / context.SCALE);
                                                                                                        xy.Add(pt.Coordinates[1] / context.SCALE);
                                                                                                        polyExt.Add(xy);
                                                                                                    }
                                                                                                    catch (System.Exception exTransf)
                                                                                                    {
                                                                                                        Console.WriteLine("7. " + exTransf.Message);
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }


                                                                                    coords.Add(polyExt);

                                                                                    props.Add("location", pos.Location.Coordinates[0] / context.SCALE + "," + pos.Location.Coordinates[1] / context.SCALE + "," + pos.Location.Coordinates[2] / context.SCALE);
                                                                                    if (pos.RefDirection != null)
                                                                                    {
                                                                                        props.Add("refDirection", pos.RefDirection.DirectionRatios[0] + "," + pos.RefDirection.DirectionRatios[1] + "," + pos.RefDirection.DirectionRatios[2]);
                                                                                    }
                                                                                    if (pos.Axis != null)
                                                                                    {
                                                                                        props.Add("axis", pos.Axis.DirectionRatios[0] + "," + pos.Axis.DirectionRatios[1] + "," + pos.Axis.DirectionRatios[2]);
                                                                                    }
                                                                                }
                                                                                else if (areaSolid.SweptArea.StepClassName == "IfcRectangleProfileDef") // Rectangle
                                                                                {
                                                                                    List <IfcRectangleProfileDef> rectangleProfile = areaSolid.SweptArea.Extract <IfcRectangleProfileDef>();

                                                                                    if (rectangleProfile.Count > 0)
                                                                                    {
                                                                                        if (rectangleProfile[0].XDim > 0.0000001 && rectangleProfile[0].YDim > 0.0000001)
                                                                                        {
                                                                                            if (rectangleProfile[0].Position.Location.Coordinates.Count >= 2)
                                                                                            {
                                                                                                try
                                                                                                {
                                                                                                    Point3D lm   = new Point3D(0, 0, 0);
                                                                                                    double  XDim = rectangleProfile[0].XDim / 2;
                                                                                                    double  YDim = rectangleProfile[0].YDim / 2;

                                                                                                    // Left-Bottom
                                                                                                    IList <double> lb  = new List <double>();
                                                                                                    Point3D        lbP = new Point3D(lm.X - XDim, lm.Y - YDim, lm.Z);
                                                                                                    lb.Add(lbP.X / context.SCALE);
                                                                                                    lb.Add(lbP.Y / context.SCALE);
                                                                                                    // right-Bottom
                                                                                                    IList <double> rb  = new List <double>();
                                                                                                    Point3D        rbP = new Point3D(lm.X + XDim, lm.Y - YDim, lm.Z);
                                                                                                    rb.Add(rbP.X / context.SCALE);
                                                                                                    rb.Add(rbP.Y / context.SCALE);
                                                                                                    // right-top
                                                                                                    IList <double> rt  = new List <double>();
                                                                                                    Point3D        rtP = new Point3D(lm.X + XDim, lm.Y + YDim, lm.Z);
                                                                                                    rt.Add(rtP.X / context.SCALE);
                                                                                                    rt.Add(rtP.Y / context.SCALE);
                                                                                                    // left-top
                                                                                                    IList <double> lt  = new List <double>();
                                                                                                    Point3D        ltP = new Point3D(lm.X - XDim, lm.Y + YDim, lm.Z);
                                                                                                    lt.Add(ltP.X / context.SCALE);
                                                                                                    lt.Add(ltP.Y / context.SCALE);

                                                                                                    IList <IList <double> > polyExt = new List <IList <double> >();
                                                                                                    polyExt.Add(lb);
                                                                                                    polyExt.Add(rb);
                                                                                                    polyExt.Add(rt);
                                                                                                    polyExt.Add(lt);
                                                                                                    polyExt.Add(lb);
                                                                                                    coords.Add(polyExt);
                                                                                                    props.Add("location", pos.Location.Coordinates[0] / context.SCALE + "," + pos.Location.Coordinates[1] / context.SCALE + "," + pos.Location.Coordinates[2] / context.SCALE);
                                                                                                    if (pos.RefDirection != null)
                                                                                                    {
                                                                                                        props.Add("refDirection", pos.RefDirection.DirectionRatios[0] + "," + pos.RefDirection.DirectionRatios[1] + "," + pos.RefDirection.DirectionRatios[2]);
                                                                                                    }
                                                                                                    if (pos.Axis != null)
                                                                                                    {
                                                                                                        props.Add("axis", pos.Axis.DirectionRatios[0] + "," + pos.Axis.DirectionRatios[1] + "," + pos.Axis.DirectionRatios[2]);
                                                                                                    }
                                                                                                }
                                                                                                catch (System.Exception exMatrixTransf)
                                                                                                {
                                                                                                    Console.WriteLine("8. " + exMatrixTransf.Message);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                                else if (areaSolid.SweptArea.StepClassName == "IfcArbitraryProfileDefWithVoids") //
                                                                                {
                                                                                    // OuterCurve [IfcCurve]
                                                                                    IfcArbitraryProfileDefWithVoids arbitraryProfileDefWithVoids = areaSolid.SweptArea as IfcArbitraryProfileDefWithVoids;
                                                                                    IfcArbitraryClosedProfileDef    arbitraryClosedProfiles      = areaSolid.SweptArea as IfcArbitraryClosedProfileDef;
                                                                                    IList <IList <double> >         polyExt = new List <IList <double> >();

                                                                                    if (arbitraryProfileDefWithVoids.OuterCurve.StepClassName == "IfcIndexedPolyCurve")
                                                                                    {
                                                                                        IfcIndexedPolyCurve     outerCurve = arbitraryClosedProfiles.OuterCurve as IfcIndexedPolyCurve;
                                                                                        IfcCartesianPointList2D points     = outerCurve.Points as IfcCartesianPointList2D;
                                                                                        foreach (double[] pts in points.CoordList)
                                                                                        {
                                                                                            if (pts.Length >= 2)
                                                                                            {
                                                                                                try
                                                                                                {
                                                                                                    IList <double> xy = new List <double>();
                                                                                                    xy.Add(pts[0] / context.SCALE);
                                                                                                    xy.Add(pts[1] / context.SCALE);
                                                                                                    polyExt.Add(xy);
                                                                                                }
                                                                                                catch (System.Exception exTransf)
                                                                                                {
                                                                                                    Console.WriteLine("9. " + exTransf.Message);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        List <IfcPolyline> poly = arbitraryProfileDefWithVoids.OuterCurve.Extract <IfcPolyline>();

                                                                                        foreach (IfcCartesianPoint pt in poly[0].Points)
                                                                                        {
                                                                                            if (pt.Coordinates.Count >= 2)
                                                                                            {
                                                                                                try
                                                                                                {
                                                                                                    IList <double> xy = new List <double>();
                                                                                                    Point3D        p  = new Point3D(pt.Coordinates[0], pt.Coordinates[1], 0);
                                                                                                    xy.Add(p.X / context.SCALE);
                                                                                                    xy.Add(p.Y / context.SCALE);
                                                                                                    polyExt.Add(xy);
                                                                                                }
                                                                                                catch (System.Exception exTransf)
                                                                                                {
                                                                                                    Console.WriteLine("10. " + exTransf.Message);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }

                                                                                    coords.Add(polyExt);

                                                                                    props.Add("location", pos.Location.Coordinates[0] / context.SCALE + "," + pos.Location.Coordinates[1] / context.SCALE + "," + pos.Location.Coordinates[2] / context.SCALE);
                                                                                    if (pos.RefDirection != null)
                                                                                    {
                                                                                        props.Add("refDirection", pos.RefDirection.DirectionRatios[0] + "," + pos.RefDirection.DirectionRatios[1] + "," + pos.RefDirection.DirectionRatios[2]);
                                                                                    }
                                                                                    if (pos.Axis != null)
                                                                                    {
                                                                                        props.Add("axis", pos.Axis.DirectionRatios[0] + "," + pos.Axis.DirectionRatios[1] + "," + pos.Axis.DirectionRatios[2]);
                                                                                    }
                                                                                }
                                                                            }
                                                                            else if (item.StepClassName == "IfcFacetedBrep-XXX")  // TODO : Fix export 3D Object
                                                                            {                                                     // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_1/FINAL/HTML/schema/ifcgeometricmodelresource/lexical/ifcfacetedbrep.htm
                                                                                List <IfcFacetedBrep> facetedBreps = item.Extract <IfcFacetedBrep>();
                                                                                if (facetedBreps.Count > 0)
                                                                                {
                                                                                    IfcFacetedBrep facetedBrep = facetedBreps[0];
                                                                                    elevation = (buildingStorey.Elevation / context.SCALE).ToString();
                                                                                    if (facetedBrep.Outer.StepClassName == "IfcClosedShell")
                                                                                    {
                                                                                        if (facetedBrep.Outer.CfsFaces.Count > 0) //
                                                                                        {
                                                                                            // CfsFaces[].Bounds[IfcFaceBound].Bound.Polgon[IfcCartesianPoint].Coordinates[3]
                                                                                            // OuterCurve [IfcCurve]
                                                                                            foreach (IfcFace cfsFace in facetedBrep.Outer.CfsFaces)
                                                                                            {
                                                                                                foreach (IfcFaceBound faceBound in cfsFace.Bounds)
                                                                                                {
                                                                                                    IList <IList <double> > polyExt = new List <IList <double> >();
                                                                                                    if (faceBound.Bound.StepClassName == "IfcPolyLoop")
                                                                                                    {
                                                                                                        IfcPolyLoop polyLoop = faceBound.Bound as IfcPolyLoop;
                                                                                                        foreach (IfcCartesianPoint pt in polyLoop.Polygon)
                                                                                                        {
                                                                                                            IList <double> xy = new List <double>();
                                                                                                            xy.Add(pt.Coordinates[0] / context.SCALE); //+ loc.X);
                                                                                                            xy.Add(pt.Coordinates[1] / context.SCALE); // + loc.Y);
                                                                                                            xy.Add(pt.Coordinates[2] / context.SCALE); // + loc.YZ;
                                                                                                            polyExt.Add(xy);
                                                                                                        }
                                                                                                    }

                                                                                                    // ERREUR OBJET 3D
                                                                                                    // TODO : Fix export 3D Object
                                                                                                    // coords.Add(polyExt);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                        catch (System.Exception exRepresentationItem)
                                                                        {
                                                                            Console.WriteLine("11. Element read error exRepresentationItem" + exRepresentationItem.Message);
                                                                            returnMessage = (int)ExitCode.UnknownError;
                                                                        }
                                                                    }
                                                                }

                                                                if (coords.Count == 0)
                                                                {
                                                                    // Console.WriteLine("12. " + coords.Count);
                                                                }

                                                                props.Add("height", height);
                                                                props.Add("elevation", elevation);

                                                                geom.type        = "Polygon";
                                                                geom.coordinates = coords;

                                                                newElementProd.boundary            = new geoFeature();
                                                                newElementProd.boundary.type       = "Feature";
                                                                newElementProd.boundary.id         = null;
                                                                newElementProd.boundary.properties = props;
                                                                newElementProd.boundary.geometry   = geom;
                                                            }
                                                            var builingElements = space.Extract <IfcBuildingElementProxy>();
                                                            // IFC Elements
                                                            foreach (var bElement in builingElements)
                                                            {
                                                                IfcRelContainedInSpatialStructure productIds = bElement.ContainedInStructure;
                                                                foreach (IfcProduct pId in productIds.RelatedElements)
                                                                {
                                                                    try
                                                                    {
                                                                        if (pId.GlobalId == product.GlobalId)
                                                                        {
                                                                            newElementProd.userData.spaceId = space.GlobalId;
                                                                        }
                                                                    }
                                                                    catch (System.Exception ex)
                                                                    {
                                                                        Console.WriteLine("13. Element read error" + ex.Message);
                                                                        returnMessage = (int)ExitCode.UnknownError;
                                                                    }
                                                                }
                                                            }
                                                        }

                                                        catch (Exception ex)
                                                        {
                                                            Console.WriteLine("16. Element read error" + ex.Message);
                                                            returnMessage = (int)ExitCode.UnknownError;
                                                        }

                                                        spaceCounter += 1;
                                                    }

                                                    // Add to list
                                                    productsIds.Add(newElementProd.id);

                                                    if (newElementProd.userData.type != "IfcBuildingStorey")
                                                    {
                                                        outputElements.Add(newElementProd);
                                                    }
                                                    else
                                                    {
                                                        // Console.WriteLine("14. Error IfcBuildingStorey");
                                                    }
                                                }
                                            }
                                            catch (NotSupportedException exEncode)
                                            {
                                                Console.WriteLine("28. Name read error (product counter: " + productCounter + ") " + exEncode.Message); // returnMessage = (int)ExitCode.NodataIsAvailableForEncoding;
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("29. Element read error" + ex.Message);
                                                returnMessage = (int)ExitCode.UnknownError;
                                            }

                                            productCounter += 1;
                                        }



                                        // IFC Elements

                                        var elements = buildingStorey.Extract <IfcBuildingElementProxy>();
                                        foreach (IfcBuildingElementProxy element in elements
                                                 .Where(element => element.GlobalId != null && !productsIds.Contains(element.GlobalId)))
                                        {
                                            try
                                            {
                                                // Add to list
                                                outputElements.Add(new JsonBuildingElementProxyIfcElement(element, storeyElement, context));
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("17. Element read error" + ex.Message);
                                                returnMessage = (int)ExitCode.UnknownError;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("18. Element read error" + ex.Message);
                            returnMessage = (int)ExitCode.UnknownError;
                        }
                    }



                    // Json Settings
                    Newtonsoft.Json.JsonSerializerSettings jsonSettings = new Newtonsoft.Json.JsonSerializerSettings {
                        NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore
                    };

                    if (activeComptactJson)
                    {
                        if (activeFullJson)
                        {
                            // Original File
                            string jsonFormat = Newtonsoft.Json.JsonConvert.SerializeObject(db.JSON(), Newtonsoft.Json.Formatting.None, jsonSettings);
                            File.WriteAllText(pathDest, jsonFormat);
                        }
                        else
                        {
                            string jsonFormat = Newtonsoft.Json.JsonConvert.SerializeObject(outputElements, Newtonsoft.Json.Formatting.None, jsonSettings);
                            File.WriteAllText(pathDest, jsonFormat);
                        }
                    }
                    else
                    {
                        if (activeFullJson)
                        {
                            // Original File
                            db.WriteFile(pathDest);
                        }
                        else
                        {
                            string jsonFormat = Newtonsoft.Json.JsonConvert.SerializeObject(outputElements, Newtonsoft.Json.Formatting.Indented, jsonSettings);
                            File.WriteAllText(pathDest, jsonFormat);
                        }
                    }
                }
                else
                {
                    returnMessage = (int)ExitCode.InvalidFilename;
                }
            }
            catch (Exception ioEx)
            {
                Console.WriteLine("19. " + ioEx.Message);
                returnMessage = (int)ExitCode.InvalidFile;
            }

            Console.WriteLine("20. " + pathDest);
            return(returnMessage);
        }
Ejemplo n.º 10
0
 public IXbimSolidSet CreateSolidSet(IfcFacetedBrep ifcSolid)
 {
     return(_engine.CreateSolidSet(ifcSolid));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// You can give the name of the TestCase -> to build only them
        /// </summary>
        /// <param name="args">Testcases to expoert</param>
        /// <help> Testcases: Spatial_simple\n
        /// Railway_spatial\n Spatial_01\nPlacement_Local"\nGeomRepresentation_01\n
        /// \nGeomRepresentation_02\nGeomRepresentation_03\nGeomRepresentation_04
        /// \nLocalPlacement_01\nLinearPlacement_02
        ///
        /// </help>
        static void Main(string[] args)
        {
            //Var declaration

            string folder       = "Unittest";
            var    testcasename = new List <string>();

            testcasename.Add("Spatial_simple");
            testcasename.Add("Railway_spatial");
            testcasename.Add("Spatial_01");
            testcasename.Add("Placement_Local");
            testcasename.Add("GeomRepresentation_01");
            testcasename.Add("GeomRepresentation_02");
            testcasename.Add("GeomRepresentation_03");
            testcasename.Add("GeomRepresentation_04");
            //testcasename.Add("GeomRepresentation_05");
            testcasename.Add("LocalPlacement_01");
            testcasename.Add("LinearPlacement_02");
            System.IO.Directory.CreateDirectory(".\\" + folder);


            //Help handling + single selection
            if (args.Length != 0)
            {
                //Help handling
                if (args.First().Equals("-?"))
                {
                    foreach (var i in testcasename)
                    {
                        Console.WriteLine(i);
                    }
                    return;
                }

                //Select only selected ones
                testcasename = new List <string>();
                foreach (var i in args)
                {
                    testcasename.Add(i);
                }
            }


            foreach (var proname in testcasename)
            {
                var db = new DatabaseIfc(ModelView.Ifc4NotAssigned);
                db.Factory.Options.GenerateOwnerHistory = false;

                var site = new IfcSite(db, "site")
                {
                    Guid = new Guid("aa4019f8-2584-44a1-a132-c17dfff69c41")
                };
                var project = new IfcProject(db, proname)
                {
                    Guid = new Guid("94d4ddac-9120-4fb9-bea0-7a414ee725d4")
                };

                new IfcRelAggregates(project, new List <IfcObjectDefinition>()
                {
                    site
                })
                {
                    Guid = new Guid("5e1fd0e5-b005-fe11-501e-5caff01dc1ad")
                };
                //Some placements
                IfcAxis2Placement3D placement1       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 2, 5, 1));
                IfcLocalPlacement   objectPlacement1 = new IfcLocalPlacement(site.ObjectPlacement, placement1);
                IfcAxis2Placement3D placement2       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 10, 5, 1));
                IfcLocalPlacement   objectPlacement2 = new IfcLocalPlacement(site.ObjectPlacement, placement2);
                IfcAxis2Placement3D placement3       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 15, 3, 6));
                IfcLocalPlacement   objectPlacement3 = new IfcLocalPlacement(site.ObjectPlacement, placement3);
                IfcAxis2Placement3D placement4       = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 5, 8, 3));
                IfcLocalPlacement   objectPlacement4 = new IfcLocalPlacement(site.ObjectPlacement, placement4);
                IfcAxis2Placement3D originaxis2place = new IfcAxis2Placement3D(db.Factory.Origin);
                IfcLocalPlacement   origionobjplace  = new IfcLocalPlacement(site.ObjectPlacement, originaxis2place);


                //Select the Testcases and fill them into the container
                switch (proname)
                {
                case "Spatial_simple":
                    //initial File
                    IfcBuilding building1 = new IfcBuilding(db, "building1")
                    {
                        Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bb42")
                    };
                    building1.ObjectPlacement = objectPlacement1;


                    IfcBuilding building2 = new IfcBuilding(db, "building2")
                    {
                        Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b441151337")
                    };
                    building2.ObjectPlacement = objectPlacement2;

                    //Write inital File
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //continue with the updated version


                    IfcBuilding building3 = new IfcBuilding(db, "building3")
                    {
                        Guid            = new Guid("fbc7f4b2-177d-4875-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement3
                    };
                    break;

                case "Railway_spatial":
                    //initial
                    IfcSpatialZone spazone1 = new IfcSpatialZone(db, "Spatialzone1")
                    {
                        Guid            = new Guid("42c7f4b2-177d-4875-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement1
                    };

                    IfcSpatialZone spazone2 = new IfcSpatialZone(db, "Spatialzone2")
                    {
                        Guid            = new Guid("42c7f4b2-1337-4875-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement2
                    };
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    IfcSpatialZone spazone3 = new IfcSpatialZone(db, "Spatialzone3")
                    {
                        Guid            = new Guid("42c7f4b2-1337-4422-88bb-d3b441153531"),
                        ObjectPlacement = objectPlacement3
                    };
                    IfcSpatialZone spazone4 = new IfcSpatialZone(db, "Spatialzone4")
                    {
                        Guid            = new Guid("42c7f4b2-1337-4875-4242-d3b441153531"),
                        ObjectPlacement = objectPlacement4
                    };

                    break;

                case "Spatial_01":
                    //creating building and add parts to it
                    building1 = new IfcBuilding(db, "building1")
                    {
                        Guid            = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bb42"),
                        ObjectPlacement = objectPlacement1
                    };

                    IfcBuildingStorey buildingsto1 = new IfcBuildingStorey(building1, "Level1", 0)
                    {
                        Guid            = new Guid("42c74222-1337-4875-4242-d3b441153531"),
                        ObjectPlacement = objectPlacement2
                    };

                    building1.IsDecomposedBy.First().Guid = new Guid("42abcd22-1337-4875-4242-abcd41153531");

                    var profile1 = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    IfcExtrudedAreaSolid      extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    IfcProductDefinitionShape shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    IfcWall wall = new IfcWall(buildingsto1, objectPlacement3, shape1)
                    {
                        Guid = new Guid("42aa4222-1337-aaaa-4242-d3aa41153531"),
                        Name = "Wall1"
                    };
                    wall.ContainedInStructure.Guid = new Guid("42c74222-1337-4875-4242-d3b44abcd531");


                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //update
                    IfcBuildingStorey buildingsto2 = new IfcBuildingStorey(building1, "Level2", 0)
                    {
                        Guid            = new Guid("42c74222-1337-4875-4242-bbbb41153531"),
                        ObjectPlacement = objectPlacement4
                    };
                    // Reassign Wall to Storey2
                    wall.ContainedInStructure.RelatingStructure = buildingsto2;

                    break;

                case "Placement_Local":
                    //Initial set
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    //Wall at origin
                    IfcWall wall2 = new IfcWall(site, origionobjplace, shape1)
                    {
                        Guid = new Guid("42aa4222-1337-aaaa-4242-d3aa41153531"),
                        Name = "Wall1"
                    };
                    wall2.ContainedInStructure.Guid = new Guid("42cab222-1337-4875-4242-d3b44abcd531");

                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    IfcAxis2Placement3D wallaxisplace = new IfcAxis2Placement3D(new IfcCartesianPoint(db, 2, 3, 0));
                    wall2.ObjectPlacement = new IfcLocalPlacement(site.ObjectPlacement, wallaxisplace);


                    break;

                case "GeomRepresentation_01":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    IfcRectangleProfileDef    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    IfcExtrudedAreaSolid      extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    IfcProductDefinitionShape shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));


                    var proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b44abcd531");

                    var proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f8e196cb-c7d9-4d53-9885-0f687706abcd")
                    };
                    proxy2.ContainedInStructure.Guid = new Guid("42cab222-1337-4875-4242-00004abcd531");


                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");
                    //Update


                    proxy2.Representation = shape1;
                    shape2.Dispose(true);     //Remove orphaned entries


                    break;

                case "GeomRepresentation_02":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbcba4b2-1c7d-4875-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b00abcd531");
                    proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f821963b-c7d9-4d53-9885-0f87cd6abcda")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3414abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    extrudedAreaSolid2.Depth = 3;
                    break;

                case "GeomRepresentation_03":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid_extrudedArea",
                        Guid = new Guid("fbcba4b2-1c7d-0000-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("00011222-1337-4875-4242-d1114abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update
                    profile1.Dispose(false);     // Remove profile
                    var profile3 = new IfcCircleProfileDef(db, "CylinderProfileDef", 4);
                    extrudedAreaSolid1.SweptArea = profile3;
                    proxy1.Name = "Cylinder_extrudedArea";



                    break;

                case "GeomRepresentation_04":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid_extrudedArea",
                        Guid = new Guid("fbcba4b2-1c7d-0000-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("00011222-1337-4875-4242-d1114abcd531");

                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update

                    var points = new List <IfcCartesianPoint>();
                    points.Add(new IfcCartesianPoint(db, -2, -3, 0));
                    points.Add(new IfcCartesianPoint(db, -2, 3, 0));
                    points.Add(new IfcCartesianPoint(db, 2, 3, 0));
                    points.Add(new IfcCartesianPoint(db, 2, -3, 0));
                    points.Add(new IfcCartesianPoint(db, -2, -3, 1.35));
                    points.Add(new IfcCartesianPoint(db, -2, 3, 1.35));
                    points.Add(new IfcCartesianPoint(db, 2, 3, 1.35));
                    points.Add(new IfcCartesianPoint(db, 2, -3, 1.35));

                    var polyloop = new List <IfcPolyLoop>();
                    polyloop.Add(new IfcPolyLoop(points[0], points[1], points[2], points[3]));
                    polyloop.Add(new IfcPolyLoop(points[0], points[4], points[5], points[1]));
                    polyloop.Add(new IfcPolyLoop(points[0], points[4], points[7], points[3]));
                    polyloop.Add(new IfcPolyLoop(points[4], points[5], points[6], points[7]));
                    polyloop.Add(new IfcPolyLoop(points[1], points[5], points[6], points[2]));
                    polyloop.Add(new IfcPolyLoop(points[3], points[7], points[6], points[2]));

                    var faceouter = new List <IfcFaceOuterBound>();
                    foreach (var i in polyloop)
                    {
                        faceouter.Add(new IfcFaceOuterBound(i, true));
                    }

                    var face = new List <IfcFace>();
                    foreach (var j in faceouter)
                    {
                        face.Add(new IfcFace(j));
                    }

                    var closedshell = new IfcClosedShell(face);
                    var brep        = new IfcFacetedBrep(closedshell);

                    shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(brep));
                    proxy1.Representation = shape2;
                    break;

                case "GeomRepresentation_05":
                    var points1 = new List <IfcCartesianPoint>();
                    points1.Add(new IfcCartesianPoint(db, -2, -3, 0));
                    points1.Add(new IfcCartesianPoint(db, -2, 3, 0));
                    points1.Add(new IfcCartesianPoint(db, 2, 3, 0));
                    points1.Add(new IfcCartesianPoint(db, 2, -3, 0));
                    var points2 = new List <IfcCartesianPoint>();
                    points2.Add(new IfcCartesianPoint(db, -2, -3, 1.35));
                    points2.Add(new IfcCartesianPoint(db, -2, 3, 1.35));
                    points2.Add(new IfcCartesianPoint(db, 2, 3, 1.35));
                    points2.Add(new IfcCartesianPoint(db, 2, -3, 1.35));

                    polyloop = new List <IfcPolyLoop>();
                    polyloop.Add(new IfcPolyLoop(points1));
                    polyloop.Add(new IfcPolyLoop(points2));


                    break;


                case "LocalPlacement_01":
                    //init
                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));

                    proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbcba4b2-1c7d-4815-88bb-d3abed15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab222-1337-4875-4242-d3b00abcd531");
                    proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f821963b-c7d9-4d53-9825-0f87cd6abcda")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ab242-1337-4875-4242-d3414abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //update
                    var point1 = new IfcCartesianPoint(db, 2, 2, 2);
                    placement1.Location = point1;


                    break;

                case "LinearPlacement_02":

                    profile1           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35);
                    shape1             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1));

                    profile2           = new IfcRectangleProfileDef(db, "rectangleProfileDef", 4, 6);
                    extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 1.35);
                    shape2             = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2));


                    IfcLine line1 = new IfcLine(new IfcCartesianPoint(db, 1, 1, 1)
                                                , new IfcVector(new IfcDirection(db, 1, 1), 20));

                    IfcLine line2 = new IfcLine(new IfcCartesianPoint(db, 1, -1, -1)
                                                , new IfcVector(new IfcDirection(db, -1, 1), 20));

                    var alignment1 = new IfcAlignment(site, line1)
                    {
                        Name = "Alignment1",
                        Guid = new Guid("fbcba4b2-1cdd-48d5-88bb-d3aced15bbaa")
                    };
                    var alignment2 = new IfcAlignment(site, line2)
                    {
                        Name = "Alignment2",
                        Guid = new Guid("f111a4b2-1c7d-4815-88bb-d3aced15bbaa")
                    };

                    var distn1 = new IfcPointByDistanceExpression(4, line1);
                    var distn2 = new IfcPointByDistanceExpression(2, line2);

                    //Deprecated but should be right for IFC4
                    var linearplace1 = new IfcLinearPlacement(line1, distn1)
                    {
                        Orientation = new IfcOrientationExpression(new IfcDirection(db, 0.5, 0.24),
                                                                   new IfcDirection(db, -0.24, 0.5))
                    };
                    var linearplace2 = new IfcLinearPlacement(line2, distn2)
                    {
                        Orientation = new IfcOrientationExpression(new IfcDirection(db, 0.75, 0.24),
                                                                   new IfcDirection(db, -0.24, 0.66))
                    };

                    proxy1 = new IfcBuildingElementProxy(site, linearplace1, shape1)
                    {
                        Name = "Cuboid1",
                        Guid = new Guid("fbcba4b2-1c7d-4815-88bb-d3aced15bbaa")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000cc222-1337-4875-4242-d3b00abcd531");
                    proxy2 = new IfcBuildingElementProxy(site, linearplace2, shape2)
                    {
                        Name = "Cuboid2",
                        Guid = new Guid("f821963b-c7d9-4d53-98a5-0f8ccd6abcda")
                    };
                    proxy1.ContainedInStructure.Guid = new Guid("000ccc42-1337-4875-4242-d3414abcd531");
                    db.WriteFile(".\\" + folder + "\\Initial_" + proname + ".ifc");
                    db.WriteXmlFile(".\\" + folder + "\\Initial_" + proname + ".ifcxml");

                    //Update

                    IfcLine line3 = new IfcLine(new IfcCartesianPoint(db, 0, 1, 0)
                                                , new IfcVector(new IfcDirection(db, 0, 5, 2), 15));
                    var distn3 = new IfcPointByDistanceExpression(4, line3);

                    linearplace1.PlacementMeasuredAlong = line3;
                    linearplace1.Distance = distn3;


                    break;


                default:
                    //exit
                    return;
                }

                db.WriteFile(".\\" + folder + "\\Update_" + proname + ".ifc");
                db.WriteXmlFile(".\\" + folder + "\\Update_" + proname + ".ifcxml");
            }
        }
Ejemplo n.º 12
0
 public IXbimShapeGeometryData Mesh(IfcFacetedBrep fBRepModel)
 {
     return(Mesh(fBRepModel.Outer));
 }
Ejemplo n.º 13
0
        public static Entity getEntityFromIfcRepresentationItem(IfcRepresentationItem reprItem, ViewportLayout viewportLayout1 = null, Transformation entityTrs = null)
        {
            Entity result = null;

            if (reprItem is IfcBooleanClippingResult)
            {
                IfcBooleanClippingResult bcr = (IfcBooleanClippingResult)reprItem;

                result = getSolidFromIfcBooleanClippingResult(bcr);
            }
            else if (reprItem is IfcCurve)
            {
                result = (Entity)getICurveFromIfcCurve((IfcCurve)reprItem, viewportLayout1, entityTrs);
            }
            else if (reprItem is IfcExtrudedAreaSolid)
            {
                IfcExtrudedAreaSolid extrAreaSolid = (IfcExtrudedAreaSolid)reprItem;

                // if (!viewportLayout1.Blocks.ContainsKey(extrAreaSolid.Index.ToString()))
                {
                    Plane pln = Conversion.getPlaneFromPosition(extrAreaSolid.Position);

                    Align3D align = new Align3D(Plane.XY, pln);

                    IfcDirection dir = extrAreaSolid.ExtrudedDirection;

                    Vector3D extDir = new Vector3D(dir.DirectionRatioX, dir.DirectionRatioY, dir.DirectionRatioZ);

                    //extDir.TransformBy(trs * align2);
                    extDir.TransformBy(align);

                    devDept.Eyeshot.Entities.Region region = getRegionFromIfcProfileDef(extrAreaSolid.SweptArea, viewportLayout1);

                    if (region != null)
                    {
                        //region.TransformBy(trs * align2);
                        region.TransformBy(align);

                        result = region.ExtrudeAsMesh(extDir * extrAreaSolid.Depth, 0.1, Mesh.natureType.Plain); // 0.1 tolerance must be computed according to object size

                        //viewportLayout1.Entities.Add(result, 1);
                        //Block b = new Block();
                        //b.Entities.Add(m);
                        //viewportLayout1.Blocks.Add(extrAreaSolid.Index.ToString(), b);
                    }
                }
                // BlockReference br = new IfcBlockReference(trs, extrAreaSolid.Index.ToString());
                // viewportLayout1.Entities.Add(br, 0, Color.Gray);
            }
            else if (reprItem is IfcFaceBasedSurfaceModel)
            {
                IfcFaceBasedSurfaceModel fbs = (IfcFaceBasedSurfaceModel)reprItem;

                result = new Mesh(0, 0, Mesh.natureType.Plain);

                foreach (IfcConnectedFaceSet cfs in fbs.FbsmFaces)
                {
                    Mesh global = new Mesh(0, 0, Mesh.natureType.Plain);

                    foreach (IfcFace face in cfs.CfsFaces)
                    {
                        Point3D[] outerPoints = null;

                        List <Point3D[]> innerPointsList = new List <Point3D[]>();

                        foreach (IfcFaceBound fb in face.Bounds)        // al massimo 2 ? profilo esterno e interno
                        {
                            // bool sense = ifb.mOrientation;

                            if (fb is IfcFaceOuterBound)
                            {
                                IfcFaceOuterBound ifob = (IfcFaceOuterBound)fb;

                                IfcPolyloop pl = (IfcPolyloop)fb.Bound;

                                List <Point3D> pLIst = new List <Point3D>();

                                for (int i = 0; i < pl.Polygon.Count; i++)
                                {
                                    Point3D p = getPoint3DFromIfcCartesianPoint(pl.Polygon[i]);

                                    if (!pLIst.Contains(p))                     // non copio punti uguali !!
                                    {
                                        pLIst.Add(p);
                                    }
                                }

                                outerPoints = pLIst.ToArray();

                                if (!outerPoints[0].Equals(outerPoints[outerPoints.Length - 1]))
                                {
                                    Array.Resize(ref outerPoints, outerPoints.Length + 1);

                                    outerPoints[outerPoints.Length - 1] = (Point3D)outerPoints[0].Clone();
                                }
                                Array.Reverse(outerPoints);
                            }
                            else
                            {
                                IfcFaceBound ifb = (IfcFaceBound)fb;

                                IfcPolyloop inPl = (IfcPolyloop)ifb.Bound;

                                List <Point3D> pLIst = new List <Point3D>();

                                for (int i = 0; i < inPl.Polygon.Count; i++)
                                {
                                    Point3D p = getPoint3DFromIfcCartesianPoint(inPl.Polygon[i]);

                                    if (!pLIst.Contains(p))                     // non copio punti uguali !!
                                    {
                                        pLIst.Add(p);
                                    }
                                }

                                Point3D[] innerPoints = pLIst.ToArray();

                                if (!innerPoints[0].Equals(innerPoints[innerPoints.Length - 1]))
                                {
                                    Array.Resize(ref innerPoints, innerPoints.Length + 1);

                                    innerPoints[innerPoints.Length - 1] = (Point3D)innerPoints[0].Clone();
                                }
                                Array.Reverse(innerPoints);

                                innerPointsList.Add(innerPoints);
                            }
                        }
                        if (outerPoints.Length > 3)
                        {
                            Mesh local;

                            List <LinearPath> boundLp = new List <LinearPath>();

                            boundLp.Add(new LinearPath(outerPoints));

                            foreach (Point3D[] innerPoints in innerPointsList)
                            {
                                boundLp.Add(new LinearPath(innerPoints));
                            }

                            local = new devDept.Eyeshot.Entities.Region(boundLp.ToArray()).ConvertToMesh(0, Mesh.natureType.Plain);

                            global.MergeWith(local, true); // fonde i vertici, sarebbe meglio farla una volta sola alla fine
                        }
                    }
                    ((Mesh)result).MergeWith(global, true);
                }
            }
            else if (reprItem is IfcFacetedBrep)  //controllare
            {
                IfcFacetedBrep facBrep = (IfcFacetedBrep)reprItem;

                IfcClosedShell cs = facBrep.Outer;

                Mesh global = new Mesh(0, 0, Mesh.natureType.Plain);

                foreach (IfcFace face in cs.CfsFaces)
                {
                    Point3D[] outerPoints = null;

                    List <Point3D[]> innerPointsList = new List <Point3D[]>();

                    foreach (IfcFaceBound fb in face.Bounds)
                    {
                        // bool sense = ifb.mOrientation;

                        if (fb is IfcFaceOuterBound)
                        {
                            IfcFaceOuterBound ifob = (IfcFaceOuterBound)fb;

                            IfcPolyloop pl = (IfcPolyloop)fb.Bound;

                            List <Point3D> pLIst = new List <Point3D>();

                            for (int i = 0; i < pl.Polygon.Count; i++)
                            {
                                Point3D p = getPoint3DFromIfcCartesianPoint(pl.Polygon[i]);

                                if (!pLIst.Contains(p))                     // non copio punti uguali !!
                                {
                                    pLIst.Add(p);
                                }
                            }

                            outerPoints = pLIst.ToArray();

                            if (!outerPoints[0].Equals(outerPoints[outerPoints.Length - 1]))
                            {
                                Array.Resize(ref outerPoints, outerPoints.Length + 1);

                                outerPoints[outerPoints.Length - 1] = (Point3D)outerPoints[0].Clone();
                            }
                            Array.Reverse(outerPoints);
                        }
                        else
                        {
                            IfcFaceBound ifb = (IfcFaceBound)fb;

                            IfcPolyloop inPl = (IfcPolyloop)ifb.Bound;

                            List <Point3D> pLIst = new List <Point3D>();

                            for (int i = 0; i < inPl.Polygon.Count; i++)
                            {
                                Point3D p = getPoint3DFromIfcCartesianPoint(inPl.Polygon[i]);

                                if (!pLIst.Contains(p))                     // non copio punti uguali !!
                                {
                                    pLIst.Add(p);
                                }
                            }

                            Point3D[] innerPoints = pLIst.ToArray();

                            if (!innerPoints[0].Equals(innerPoints[innerPoints.Length - 1]))
                            {
                                Array.Resize(ref innerPoints, innerPoints.Length + 1);

                                innerPoints[innerPoints.Length - 1] = (Point3D)innerPoints[0].Clone();
                            }
                            Array.Reverse(innerPoints);

                            innerPointsList.Add(innerPoints);
                        }
                    }
                    if (outerPoints.Length > 3)
                    {
                        Mesh local;

                        List <LinearPath> boundLp = new List <LinearPath>();

                        boundLp.Add(new LinearPath(outerPoints));

                        foreach (Point3D[] innerPoints in innerPointsList)
                        {
                            boundLp.Add(new LinearPath(innerPoints));
                        }
                        local = new devDept.Eyeshot.Entities.Region(boundLp.ToArray()).ConvertToMesh(0, Mesh.natureType.Plain);

                        global.MergeWith(local, true); // fonde i vertici, sarebbe meglio farla una volta sola alla fine
                    }
                }

                result = global;
            }
            //else if (repItem is IfcBoundingBox)
            //{
            //    IfcBoundingBox bBox = (IfcBoundingBox)iRep.Items[0];
            //    m = Mesh.CreateBox(bBox.XDim, bBox.YDim, bBox.ZDim);
            //    m.Translate(bBox.Corner.Coordinates.Item1, bBox.Corner.Coordinates.Item1, bBox.Corner.Coordinates.Item1);
            //}
            else if (reprItem is IfcMappedItem)
            {
                IfcMappedItem mapItem = (IfcMappedItem)reprItem;

                if (!viewportLayout1.Blocks.ContainsKey("MappingSource " + mapItem.MappingSource.Index.ToString()))
                {
                    IfcRepresentationMap reprMapSource = mapItem.MappingSource;

                    Entity mapSource = getEntityFromIfcRepresentation(reprMapSource.MappedRepresentation, viewportLayout1, entityTrs);

                    Block b = new Block();

                    if (mapSource != null)
                    {
                        Plane pln = getPlaneFromPosition((IfcPlacement)reprMapSource.MappingOrigin);

                        Align3D algn = new Align3D(Plane.XY, pln);

                        mapSource.TransformBy(algn);

                        b.Entities.Add(mapSource);
                    }

                    viewportLayout1.Blocks.Add("MappingSource " + mapItem.MappingSource.Index.ToString(), b);
                }

                IfcCartesianTransformationOperator3D iTrs = (IfcCartesianTransformationOperator3D)mapItem.MappingTarget;

                Point3D org = new Point3D(iTrs.LocalOrigin.Coordinates.Item1, iTrs.LocalOrigin.Coordinates.Item2, iTrs.LocalOrigin.Coordinates.Item3);

                Vector3D vectorX;

                if (iTrs.Axis1 != null)
                {
                    vectorX = new Vector3D(iTrs.Axis1.DirectionRatioX, iTrs.Axis1.DirectionRatioY, iTrs.Axis1.DirectionRatioZ);
                }
                else
                {
                    vectorX = new Vector3D(1, 0, 0);
                }
                vectorX = vectorX * iTrs.Scale;

                Vector3D vectorY;

                if (iTrs.Axis2 != null)
                {
                    vectorY = new Vector3D(iTrs.Axis2.DirectionRatioX, iTrs.Axis2.DirectionRatioY, iTrs.Axis2.DirectionRatioZ);
                }
                else
                {
                    vectorY = new Vector3D(0, 1, 0);
                }

                Vector3D vectorZ;

                if (iTrs.Axis1 != null)
                {
                    vectorZ = new Vector3D(iTrs.Axis3.DirectionRatioX, iTrs.Axis3.DirectionRatioY, iTrs.Axis3.DirectionRatioZ);
                }
                else
                {
                    vectorZ = new Vector3D(0, 0, 1);
                }

                if (iTrs is IfcCartesianTransformationOperator3DnonUniform)
                {
                    IfcCartesianTransformationOperator3DnonUniform nut = (IfcCartesianTransformationOperator3DnonUniform)iTrs;

                    vectorY = vectorY * nut.Scale2;

                    vectorZ = vectorZ * nut.Scale3;
                }


                Transformation targetTrs = new Transformation(org, vectorX, vectorY, vectorZ);

                result = new IfcBlockReference(targetTrs, "MappingSource " + mapItem.MappingSource.Index.ToString());
            }
            else if (reprItem is IfcShellBasedSurfaceModel)
            {
                IfcShellBasedSurfaceModel sbs = (IfcShellBasedSurfaceModel)reprItem;

                result = new Mesh(0, 0, Mesh.natureType.Plain);

                foreach (IfcShell cfs in sbs.SbsmBoundary)
                {
                    Mesh global = new Mesh(0, 0, Mesh.natureType.Plain);

                    foreach (IfcFace face in cfs.CfsFaces)
                    {
                        Point3D[] outerPoints = null;

                        List <Point3D[]> innerPointsList = new List <Point3D[]>();

                        foreach (IfcFaceBound fb in face.Bounds)        // al massimo 2 ? profilo esterno e interno
                        {
                            // bool sense = ifb.mOrientation;

                            if (fb is IfcFaceOuterBound)
                            {
                                IfcFaceOuterBound ifob = (IfcFaceOuterBound)fb;

                                IfcPolyloop pl = (IfcPolyloop)fb.Bound;

                                List <Point3D> pLIst = new List <Point3D>();

                                for (int i = 0; i < pl.Polygon.Count; i++)
                                {
                                    Point3D p = getPoint3DFromIfcCartesianPoint(pl.Polygon[i]);

                                    if (!pLIst.Contains(p))                     // non copio punti uguali !!
                                    {
                                        pLIst.Add(p);
                                    }
                                }

                                outerPoints = pLIst.ToArray();

                                if (!outerPoints[0].Equals(outerPoints[outerPoints.Length - 1]))
                                {
                                    Array.Resize(ref outerPoints, outerPoints.Length + 1);

                                    outerPoints[outerPoints.Length - 1] = (Point3D)outerPoints[0].Clone();
                                }
                                Array.Reverse(outerPoints);
                            }
                            else
                            {
                                IfcFaceBound ifb = (IfcFaceBound)fb;

                                IfcPolyloop inPl = (IfcPolyloop)ifb.Bound;

                                List <Point3D> pLIst = new List <Point3D>();

                                for (int i = 0; i < inPl.Polygon.Count; i++)
                                {
                                    Point3D p = getPoint3DFromIfcCartesianPoint(inPl.Polygon[i]);

                                    if (!pLIst.Contains(p))                     // non copio punti uguali !!
                                    {
                                        pLIst.Add(p);
                                    }
                                }

                                Point3D[] innerPoints = pLIst.ToArray();

                                if (!innerPoints[0].Equals(innerPoints[innerPoints.Length - 1]))
                                {
                                    Array.Resize(ref innerPoints, innerPoints.Length + 1);

                                    innerPoints[innerPoints.Length - 1] = (Point3D)innerPoints[0].Clone();
                                }
                                Array.Reverse(innerPoints);

                                innerPointsList.Add(innerPoints);
                            }
                        }
                        if (outerPoints.Length > 3)
                        {
                            Mesh local;

                            List <LinearPath> boundLp = new List <LinearPath>();

                            boundLp.Add(new LinearPath(outerPoints));

                            foreach (Point3D[] innerPoints in innerPointsList)
                            {
                                boundLp.Add(new LinearPath(innerPoints));
                            }

                            //devDept.Eyeshot.Entities.Region localRegion = new devDept.Eyeshot.Entities.Region(boundLp.ToArray());

                            //localRegion.TransformBy(entityTrs);

                            //viewportLayout1.Entities.Add(localRegion, 1);



                            local = new devDept.Eyeshot.Entities.Region(boundLp.ToArray()).ConvertToMesh(0, Mesh.natureType.Plain);



                            global.MergeWith(local, true); // fonde i vertici, sarebbe meglio farla una volta sola alla fine
                        }
                    }
                    ((Mesh)result).MergeWith(global, true);
                }
            }
            else
            {
                if (!debug.Contains("IfcRepresentationItem not supported: " + reprItem.KeyWord))
                {
                    debug += "IfcRepresentationItem not supported: " + reprItem.KeyWord + "\n";
                }
            }

            if (result != null)
            {
                Color color;
                if (tryGetColorFromIfcRepresentationItem(reprItem, out color))
                {
                    result.ColorMethod = colorMethodType.byEntity;

                    result.Color = color;
                }
                else
                {
                    result.ColorMethod = colorMethodType.byParent;
                }
            }

            return(result);
        }