Example #1
0
        public IIfcElement CreateExtrusion(
            ref List <IIfcProduct> elements,
            List <Point> points,
            List <double> chamfers,
            double height,
            Guid guid)
        {
            IfcAxis2Placement          plateLocation          = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirZ, this.DirY));
            IIfcAxis2Placement3D       axis2Placement3D       = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(0.0, 0.0, 0.0), IfcTools.CreateDirection(0.0, 1.0, 0.0), IfcTools.CreateDirection(0.0, 0.0, 1.0));
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.CreateExtrudedAreaSolid((IIfcProfileDef)IfcTools.CreateArbitraryClosedProfileDef(IfcProfileTypeEnum.IFC_AREA, (IIfcCurve)IfcTools.CreateChamferedCurvedPolyline(points, chamfers)), axis2Placement3D, IfcTools.CreateDirection(0.0, 0.0, 1.0), (IfcPositiveLengthMeasure)height), "Body", "SweptSolid")
            });
            IIfcPlate plate = IfcTools.CreatePlate(plateLocation, (IIfcProductRepresentation)productDefinitionShape, guid);

            IfcTools.AddQuantities((IIfcObject)plate);
            IfcTools.AddColorToElement((IIfcElement)plate, "brown");
            IfcTools.AddMaterialToElement(new List <IIfcRoot>()
            {
                (IIfcRoot)plate
            }, "Undefined");
            if (!string.IsNullOrEmpty(this.Reference))
            {
                Dictionary <string, object> attributes = new Dictionary <string, object>()
                {
                    {
                        "PDMS_ID",
                        (object)(IfcLabel)this.Reference
                    }
                };
                IfcTools.AddProperties((IIfcObject)plate, "PDMS Common", attributes);
            }
            elements.Add((IIfcProduct)plate);
            return((IIfcElement)plate);
        }
Example #2
0
 private static void Report(IIfcProductDefinitionShape ifcProductDefinitionShape, TextHighliter sb)
 {
     foreach (var item in ifcProductDefinitionShape.Representations)
     {
         Report(item, sb);
     }
 }
Example #3
0
        public IIfcElement CreateCylinder(
            ref List <IIfcProduct> elements,
            double height,
            double radius,
            Guid guid)
        {
            IfcAxis2Placement          beamLocation           = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirZ, this.DirY));
            IIfcAxis2Placement2D       axis2Placement2D       = IfcTools.CreateAxis2Placement2D(IfcTools.CreatePoint(0.0, 0.0), IfcTools.CreateDirection(1.0, 0.0));
            IIfcAxis2Placement3D       axis2Placement3D       = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(0.0, 0.0, -height / 2.0), IfcTools.CreateDirection(0.0, 0.0, 1.0), IfcTools.CreateDirection(0.0, -1.0, 0.0));
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.CreateExtrudedAreaSolid((IIfcProfileDef)IfcTools.IfcDatabase.CreateIfcCircleProfileDef(new IfcProfileTypeEnum?(IfcProfileTypeEnum.IFC_AREA), (IfcLabel)string.Empty, axis2Placement2D, (IfcPositiveLengthMeasure)radius), axis2Placement3D, IfcTools.CreateDirection(0.0, 0.0, 1.0), (IfcPositiveLengthMeasure)height), "Body", "SweptSolid")
            });
            IIfcBeam beam = IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid);

            IfcTools.AddQuantities((IIfcObject)beam);
            IfcTools.AddColorToElement((IIfcElement)beam, "yellow");
            IfcTools.AddMaterialToElement(new List <IIfcRoot>()
            {
                (IIfcRoot)beam
            }, "Undefined");
            if (!string.IsNullOrEmpty(this.Reference))
            {
                Dictionary <string, object> attributes = new Dictionary <string, object>()
                {
                    {
                        "PDMS_ID",
                        (object)(IfcLabel)this.Reference
                    }
                };
                IfcTools.AddProperties((IIfcObject)beam, "PDMS Common", attributes);
            }
            elements.Add((IIfcProduct)beam);
            return((IIfcElement)beam);
        }
Example #4
0
        public IIfcElement CreatePyramid(
            ref List <IIfcProduct> elements,
            double height,
            double botX,
            double botY,
            double topX,
            double topY,
            double deltaX,
            double deltaY,
            Guid guid)
        {
            List <IIfcCompositeCurveSegment> Segments         = new List <IIfcCompositeCurveSegment>();
            IfcAxis2Placement           beamLocation          = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirZ, this.DirX));
            IIfcAxis2Placement2D        axis2Placement2D      = IfcTools.CreateAxis2Placement2D(IfcTools.CreatePoint(0.0, 0.0), IfcTools.CreateDirection(1.0, 0.0));
            List <IIfcAxis2Placement3D> CrossSectionPositions = new List <IIfcAxis2Placement3D>()
            {
                IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(-deltaX / 2.0, -deltaY / 2.0, -height / 2.0), IfcTools.CreateDirection(0.0, 0.0, 1.0), IfcTools.CreateDirection(1.0, 0.0, 0.0)),
                IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(deltaX / 2.0, deltaY / 2.0, height / 2.0), IfcTools.CreateDirection(0.0, 0.0, 1.0), IfcTools.CreateDirection(1.0, 0.0, 0.0))
            };
            List <IIfcProfileDef> CrossSections = new List <IIfcProfileDef>()
            {
                (IIfcProfileDef)IfcTools.IfcDatabase.CreateIfcRectangleProfileDef(new IfcProfileTypeEnum?(IfcProfileTypeEnum.IFC_AREA), (IfcLabel)string.Empty, axis2Placement2D, (IfcPositiveLengthMeasure)botX, (IfcPositiveLengthMeasure)botY),
                (IIfcProfileDef)IfcTools.IfcDatabase.CreateIfcRectangleProfileDef(new IfcProfileTypeEnum?(IfcProfileTypeEnum.IFC_AREA), (IfcLabel)string.Empty, axis2Placement2D, (IfcPositiveLengthMeasure)topX, (IfcPositiveLengthMeasure)topY)
            };
            IIfcCompositeCurveSegment compositeCurveSegment = IfcTools.IfcDatabase.CreateIfcCompositeCurveSegment(new IfcTransitionCode?(IfcTransitionCode.IFC_CONTINUOUS), new bool?(true), (IIfcCurve)IfcTools.IfcDatabase.CreateIfcPolyline(new List <IIfcCartesianPoint>()
            {
                IfcTools.CreatePoint(-deltaX / 2.0, -deltaY / 2.0, -height / 2.0),
                IfcTools.CreatePoint(deltaX / 2.0, deltaY / 2.0, height / 2.0)
            }));

            Segments.Add(compositeCurveSegment);
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.IfcDatabase.CreateIfcSectionedSpine(IfcTools.IfcDatabase.CreateIfcCompositeCurve(Segments, new LogicalEnum?(LogicalEnum.IFC_FALSE)), CrossSections, CrossSectionPositions), "Body", "SectionedSpine")
            });
            IIfcBeam beam = IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid);

            IfcTools.AddQuantities((IIfcObject)beam);
            IfcTools.AddColorToElement((IIfcElement)beam, "green");
            IfcTools.AddMaterialToElement(new List <IIfcRoot>()
            {
                (IIfcRoot)beam
            }, "Undefined");
            if (!string.IsNullOrEmpty(this.Reference))
            {
                Dictionary <string, object> attributes = new Dictionary <string, object>()
                {
                    {
                        "PDMS_ID",
                        (object)(IfcLabel)this.Reference
                    }
                };
                IfcTools.AddProperties((IIfcObject)beam, "PDMS Common", attributes);
            }
            elements.Add((IIfcProduct)beam);
            return((IIfcElement)beam);
        }
Example #5
0
        //输入模型和ifcproductdefinitionshape的label,返回几何表达方法
        private HashSet <string> getRepresentation(int label)
        {
            HashSet <string>           reps  = new HashSet <string>();
            IIfcProductDefinitionShape shape = (IIfcProductDefinitionShape)model.Instances[label];
            var representations = shape.Representations;

            foreach (var item in representations)
            {
                reps.Add(item.RepresentationType);
                //Console.WriteLine("look!"+item.RepresentationType);
            }
            return(reps);
        }
Example #6
0
        public IIfcBeam CreateStraight(
            ref List <IIfcProduct> elements,
            IIfcProfileDef profile,
            double length,
            Guid guid)
        {
            IfcAxis2Placement          beamLocation           = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirZ, this.DirX));
            IIfcAxis2Placement3D       axis2Placement3D       = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(0.0, 0.0, 0.0), IfcTools.CreateDirection(0.0, 0.0, 1.0), IfcTools.CreateDirection(1.0, 0.0, 0.0));
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.CreateExtrudedAreaSolid(profile, axis2Placement3D, IfcTools.CreateDirection(0.0, 0.0, 1.0), (IfcPositiveLengthMeasure)length), "Body", "SweptSolid")
            });

            return(IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid));
        }
Example #7
0
        public IIfcBeam CreateCurve(
            ref List <IIfcProduct> elements,
            IIfcProfileDef profile,
            double radius,
            double angle,
            Guid guid)
        {
            IfcAxis2Placement          beamLocation           = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirX, this.DirZ));
            IIfcAxis2Placement3D       axis2Placement3D       = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(0.0, 0.0, 0.0), IfcTools.CreateDirection(1.0, 0.0, 0.0), IfcTools.CreateDirection(0.0, 1.0, 0.0));
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.CreateCurvedBeam(profile, axis2Placement3D, IfcTools.IfcDatabase.CreateIfcAxis1Placement(IfcTools.CreatePoint(0.0, 0.0, 0.0), IfcTools.CreateDirection(1.0, 0.0, 0.0)), (IfcPlaneAngleMeasure)angle), "Body", "SweptSolid")
            });

            return(IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid));
        }
Example #8
0
        public IIfcElement CreatePolyHedron(
            ref List <IIfcProduct> elements,
            List <List <Point> > faces,
            Guid guid)
        {
            List <IIfcFace>   CfsFaces     = new List <IIfcFace>();
            IfcAxis2Placement beamLocation = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirZ, this.DirX));

            foreach (List <Point> face in faces)
            {
                face.Reverse();
                List <IIfcCartesianPoint> Polygon = new List <IIfcCartesianPoint>();
                foreach (Point point in face)
                {
                    Polygon.Insert(0, IfcTools.CreatePoint(point.X, point.Y, point.Z));
                }
                CfsFaces.Add(IfcTools.CreatePolygon((IIfcFaceBound)IfcTools.IfcDatabase.CreateIfcFaceOuterBound((IIfcLoop)IfcTools.IfcDatabase.CreateIfcPolyLoop(Polygon), new bool?(true))));
            }
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.IfcDatabase.CreateIfcFacetedBrep(IfcTools.IfcDatabase.CreateIfcClosedShell(CfsFaces)), "Body", "Brep")
            });
            IIfcBeam beam = IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid);

            IfcTools.AddQuantities((IIfcObject)beam);
            IfcTools.AddColorToElement((IIfcElement)beam, "green");
            IfcTools.AddMaterialToElement(new List <IIfcRoot>()
            {
                (IIfcRoot)beam
            }, "Undefined");
            if (!string.IsNullOrEmpty(this.Reference))
            {
                Dictionary <string, object> attributes = new Dictionary <string, object>()
                {
                    {
                        "PDMS_ID",
                        (object)(IfcLabel)this.Reference
                    }
                };
                IfcTools.AddProperties((IIfcObject)beam, "PDMS Common", attributes);
            }
            elements.Add((IIfcProduct)beam);
            return((IIfcElement)beam);
        }
Example #9
0
        public IIfcElement CreateSlopedCylinder(
            ref List <IIfcProduct> elements,
            double height,
            double radius,
            double botX,
            double botY,
            double topX,
            double topY,
            Guid guid)
        {
            double                     num1                   = Math.Max(radius * Math.Tan(Math.Abs(botX * Math.PI / 180.0)), radius * Math.Tan(Math.Abs(botY * Math.PI / 180.0)));
            double                     num2                   = Math.Max(radius * Math.Tan(Math.Abs(topX * Math.PI / 180.0)), radius * Math.Tan(Math.Abs(topY * Math.PI / 180.0)));
            IfcAxis2Placement          beamLocation           = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirZ, this.DirY));
            IIfcAxis2Placement2D       axis2Placement2D       = IfcTools.CreateAxis2Placement2D(IfcTools.CreatePoint(0.0, 0.0), IfcTools.CreateDirection(1.0, 0.0));
            IIfcAxis2Placement3D       axis2Placement3D       = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(0.0, 0.0, -height / 2.0 - num1), IfcTools.CreateDirection(0.0, 0.0, 1.0), IfcTools.CreateDirection(1.0, 0.0, 0.0));
            IIfcExtrudedAreaSolid      extrudedAreaSolid      = IfcTools.CreateExtrudedAreaSolid((IIfcProfileDef)IfcTools.IfcDatabase.CreateIfcCircleProfileDef(new IfcProfileTypeEnum?(IfcProfileTypeEnum.IFC_AREA), (IfcLabel)string.Empty, axis2Placement2D, (IfcPositiveLengthMeasure)radius), axis2Placement3D, IfcTools.CreateDirection(0.0, 0.0, 1.0), (IfcPositiveLengthMeasure)(height + num1 + num2));
            IIfcBooleanClippingResult  booleanClippingResult1 = (IIfcBooleanClippingResult)null;
            IIfcBooleanClippingResult  booleanClippingResult2 = (IIfcBooleanClippingResult)null;
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                booleanClippingResult2 == null ? (booleanClippingResult1 == null ? IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)extrudedAreaSolid, "Body", "SweptSolid") : IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)booleanClippingResult1, "Body", "Clipping")) : IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)booleanClippingResult2, "Body", "Clipping")
            });
            IIfcBeam beam = IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid);

            IfcTools.AddQuantities((IIfcObject)beam);
            IfcTools.AddColorToElement((IIfcElement)beam, "green");
            IfcTools.AddMaterialToElement(new List <IIfcRoot>()
            {
                (IIfcRoot)beam
            }, "Undefined");
            if (!string.IsNullOrEmpty(this.Reference))
            {
                Dictionary <string, object> attributes = new Dictionary <string, object>()
                {
                    {
                        "PDMS_ID",
                        (object)(IfcLabel)this.Reference
                    }
                };
                IfcTools.AddProperties((IIfcObject)beam, "PDMS Common", attributes);
            }
            elements.Add((IIfcProduct)beam);
            return((IIfcElement)beam);
        }
Example #10
0
        public IIfcElement CreateRevolution(
            ref List <IIfcProduct> elements,
            List <Point> points,
            List <double> chamfers,
            double angle,
            Guid guid)
        {
            IIfcProfileDef             profile                = IfcTools.CreateProfile(points, chamfers, "REVO");
            IfcAxis2Placement          beamLocation           = new IfcAxis2Placement(IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirY, this.DirX));
            IIfcAxis2Placement3D       axis2Placement3D       = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(0.0, 0.0, 0.0), IfcTools.CreateDirection(0.0, 1.0, 0.0), IfcTools.CreateDirection(1.0, 0.0, 0.0));
            IIfcProductDefinitionShape productDefinitionShape = IfcTools.IfcDatabase.CreateIfcProductDefinitionShape((IfcLabel)null, (IfcText)null, new List <IIfcRepresentation>()
            {
                IfcTools.CreateShapeRepresentation((IIfcRepresentationItem)IfcTools.CreateCurvedBeam(profile, axis2Placement3D, IfcTools.IfcDatabase.CreateIfcAxis1Placement(IfcTools.CreatePoint(0.0, 0.0, 0.0), IfcTools.CreateDirection(1.0, 0.0, 0.0)), (IfcPlaneAngleMeasure)angle), "Body", "SweptSolid")
            });
            IIfcBeam beam = IfcTools.CreateBeam(beamLocation, (IIfcProductRepresentation)productDefinitionShape, guid);

            IfcTools.AddQuantities((IIfcObject)beam);
            IfcTools.AddColorToElement((IIfcElement)beam, "beige");
            IfcTools.AddMaterialToElement(new List <IIfcRoot>()
            {
                (IIfcRoot)beam
            }, "Undefined");
            if (!string.IsNullOrEmpty(this.Reference))
            {
                Dictionary <string, object> attributes = new Dictionary <string, object>()
                {
                    {
                        "PDMS_ID",
                        (object)(IfcLabel)this.Reference
                    }
                };
                IfcTools.AddProperties((IIfcObject)beam, "PDMS Common", attributes);
            }
            elements.Add((IIfcProduct)beam);
            return((IIfcElement)beam);
        }