예제 #1
0
        public static XbimMatrix3D ToMatrix3D(this IIfcAxis2Placement2D axis2)
        {
            if (axis2.RefDirection != null)
            {
                var v = new XbimVector3D(axis2.RefDirection.X, axis2.RefDirection.Y, axis2.RefDirection.Z);
                v = v.Normalized();
                return(new XbimMatrix3D(
                           v.X, v.Y, 0, 0,
                           v.Y, v.X, 0, 0,
                           0, 0, 1, 0,
                           axis2.Location.X, axis2.Location.Y, 0, 1));
            }
            double LocationZ = axis2.Location.Z;

            if (double.IsNaN(LocationZ))
            {
                LocationZ = 0;
            }

            return(new XbimMatrix3D(
                       1, 0, 0, 0,
                       0, 1, 0, 0,
                       0, 0, 1, 0,
                       axis2.Location.X, axis2.Location.Y, LocationZ, 1
                       ));
        }
예제 #2
0
 public IXbimGeometryObject Moved(IXbimGeometryObject geometryObject, IIfcAxis2Placement2D placement)
 {
     using (new Tracer(LogHelper.CurrentFunctionName(), this._logger, geometryObject))
     {
         return(_engine.Moved(geometryObject, placement));
     }
 }
예제 #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);
        }
예제 #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);
        }
예제 #5
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);
        }
예제 #6
0
 public IXbimGeometryObject Moved(IXbimGeometryObject geometryObject, IIfcAxis2Placement2D placement)
 {
     return(_engine.Moved(geometryObject, placement));
 }