示例#1
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);
        }
示例#2
0
        public static BeamSt GetBeamsSteelData(IIfcBeam beamSt)
        {
            Point location = new Point();

            location.X = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                          .RelativePlacement as IIfcAxis2Placement3D).Location.X;

            location.Y = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                          .RelativePlacement as IIfcAxis2Placement3D).Location.Y;

            location.Z = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                          .RelativePlacement as IIfcAxis2Placement3D).Location.Z;


            Point refDirection = new Point();

            refDirection.X = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                              .RelativePlacement as IIfcAxis2Placement3D).RefDirection.X;

            refDirection.Y = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                              .RelativePlacement as IIfcAxis2Placement3D).RefDirection.Y;

            refDirection.Z = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                              .RelativePlacement as IIfcAxis2Placement3D).RefDirection.Z;

            Point axis = new Point();

            axis.X = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                      .RelativePlacement as IIfcAxis2Placement3D).Axis.X;

            axis.Y = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                      .RelativePlacement as IIfcAxis2Placement3D).Axis.Y;

            axis.Z = ((beamSt.ObjectPlacement as IIfcLocalPlacement)
                      .RelativePlacement as IIfcAxis2Placement3D).Axis.Z;

            BeamSt B = new BeamSt()
            {
                Name         = beamSt.Name,
                RefDirection = refDirection,
                Axis         = axis,
                Location     = location,
                Length       = ((beamSt.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid).Depth,

                Width = (((beamSt.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid)
                         .SweptArea as IIfcIShapeProfileDef).OverallWidth,

                Depth = (((beamSt.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid)
                         .SweptArea as IIfcIShapeProfileDef).OverallDepth,

                FlangeTh = (((beamSt.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid)
                            .SweptArea as IIfcIShapeProfileDef).FlangeThickness,

                WebTh = (((beamSt.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid)
                         .SweptArea as IIfcIShapeProfileDef).WebThickness,
            };

            return(B);
        }
示例#3
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);
        }
示例#4
0
        public static Beam GetBeamsData(IIfcBeam beam)
        {
            Point location = new Point();

            location.X = ((beam.ObjectPlacement as IIfcLocalPlacement)
                          .RelativePlacement as IIfcAxis2Placement3D).Location.X;

            location.Y = ((beam.ObjectPlacement as IIfcLocalPlacement)
                          .RelativePlacement as IIfcAxis2Placement3D).Location.Y;

            location.Z = ((beam.ObjectPlacement as IIfcLocalPlacement)
                          .RelativePlacement as IIfcAxis2Placement3D).Location.Z;


            Point refDirection = new Point();

            refDirection.X = ((beam.ObjectPlacement as IIfcLocalPlacement)
                              .RelativePlacement as IIfcAxis2Placement3D).RefDirection.X;

            refDirection.Y = ((beam.ObjectPlacement as IIfcLocalPlacement)
                              .RelativePlacement as IIfcAxis2Placement3D).RefDirection.Y;

            refDirection.Z = ((beam.ObjectPlacement as IIfcLocalPlacement)
                              .RelativePlacement as IIfcAxis2Placement3D).RefDirection.Z;

            Point axis = new Point();

            axis.X = ((beam.ObjectPlacement as IIfcLocalPlacement)
                      .RelativePlacement as IIfcAxis2Placement3D).Axis.X;

            axis.Y = ((beam.ObjectPlacement as IIfcLocalPlacement)
                      .RelativePlacement as IIfcAxis2Placement3D).Axis.Y;

            axis.Z = ((beam.ObjectPlacement as IIfcLocalPlacement)
                      .RelativePlacement as IIfcAxis2Placement3D).Axis.Z;

            Beam B = new Beam()
            {
                Name         = beam.Name,
                RefDirection = refDirection,
                Axis         = axis,
                Location     = location,
                H            = (((beam.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid)
                                .SweptArea as IIfcRectangleProfileDef).YDim,
                B = (((beam.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid)
                     .SweptArea as IIfcRectangleProfileDef).XDim,
                Length = ((beam.Representation.Representations.FirstOrDefault() as IIfcShapeRepresentation).Items.FirstOrDefault() as IIfcExtrudedAreaSolid).Depth
            };

            return(B);
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
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);
        }