Пример #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);
        }
Пример #2
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);
        }
Пример #3
0
        public ProfileToElements(string name, Profile elementProfile, List <Line> insertLines, double angle, Material material, int type)
        {
            Name         = name;
            Material     = material;
            Profile      = elementProfile;
            ElementLines = insertLines;
            Amount       = insertLines.Count;
            ElementType  = IfcTools.IntToType(type);

            double surfaceArea = elementProfile.BoundarySurfaces[0].GetArea();

            Volume = insertLines.Sum(line => surfaceArea * line.Length);

            Mass = Volume * material.Density;
            SectionInsertPlanes = new List <Plane>();
            Breps = new List <Brep>();

            foreach (var line in insertLines)
            {
                Curve    lineCurve           = line.ToNurbsCurve();
                double[] divisionParameters  = lineCurve.DivideByCount(1, true);
                Plane[]  perpendicularPlanes = lineCurve.GetPerpendicularFrames(divisionParameters);
                Plane    sectionInsertPlane  = perpendicularPlanes[0].Clone();
                sectionInsertPlane.Rotate(angle, sectionInsertPlane.ZAxis);
                SectionInsertPlanes.Add(sectionInsertPlane);

                Transform planeToPlane   = Transform.PlaneToPlane(Plane.WorldXY, sectionInsertPlane);
                Curve     duplicateCurve = elementProfile.ProfileCurve.DuplicateCurve();
                duplicateCurve.Transform(planeToPlane);

                Breps.Add(Brep.CreateFromSweep(line.ToNurbsCurve(), duplicateCurve, true, elementProfile.Tolerance)[0]);
            }
        }
Пример #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 IIfcRevolvedAreaSolid CreateSolid(
            IIfcProfileDef profile,
            double radius,
            double angle)
        {
            IIfcAxis1Placement   ifcAxis1Placement = IfcTools.IfcDatabase.CreateIfcAxis1Placement(IfcTools.CreatePoint(radius, 0.0, 0.0), IfcTools.CreateDirection(0.0, 1.0, 0.0));
            IIfcAxis2Placement3D axis2Placement3D  = IfcTools.CreateAxis2Placement3D(IfcTools.CreatePoint(this.Position.get_X(), this.Position.get_Y(), this.Position.get_Z()), this.DirY, this.DirX);

            return(IfcTools.CreateRevolvedAreaSolid(profile, axis2Placement3D, ifcAxis1Placement, (IfcPlaneAngleMeasure)angle));
        }
Пример #6
0
        public override List <IfcBuildingElement> ToBuildingElementIfc(IfcStore model)
        {
            using (var transaction = model.BeginTransaction("Create Profile Element"))
            {
                var material = model.Instances.New <IfcMaterial>();
                material.Category = Material.Name;
                material.Name     = Material.Grade;
                var ifcRelAssociatesMaterial = model.Instances.New <IfcRelAssociatesMaterial>();
                ifcRelAssociatesMaterial.RelatingMaterial = material;

                var ifcCartesianPoints = IfcTools.PointsToIfcCartesianPoints(model, Profile.ProfilePoints, true);

                var polyline = model.Instances.New <IfcPolyline>();
                polyline.Points.AddRange(ifcCartesianPoints);

                var profile = model.Instances.New <IfcArbitraryClosedProfileDef>();
                profile.OuterCurve  = polyline;
                profile.ProfileName = Profile.Name;
                profile.ProfileType = IfcProfileTypeEnum.AREA;

                List <IfcShapeRepresentation> shapes = new List <IfcShapeRepresentation>();

                foreach (var t in ElementLines)
                {
                    var body = model.Instances.New <IfcExtrudedAreaSolid>();
                    body.Depth             = t.Length;
                    body.SweptArea         = profile;
                    body.ExtrudedDirection = model.Instances.New <IfcDirection>();
                    body.ExtrudedDirection.SetXYZ(0, 0, 1);

                    var origin = model.Instances.New <IfcCartesianPoint>();
                    origin.SetXYZ(0, 0, 0);
                    body.Position          = model.Instances.New <IfcAxis2Placement3D>();
                    body.Position.Location = origin;

                    var shape        = model.Instances.New <IfcShapeRepresentation>();
                    var modelContext = model.Instances.OfType <IfcGeometricRepresentationContext>().FirstOrDefault();
                    shape.ContextOfItems           = modelContext;
                    shape.RepresentationType       = "SweptSolid";
                    shape.RepresentationIdentifier = "Body";
                    shape.Items.Add(body);

                    shapes.Add(shape);
                }

                var buildingElements = IfcTools.CreateBuildingElements(model, ElementType, Name, shapes, SectionInsertPlanes,
                                                                       ifcRelAssociatesMaterial);

                transaction.Commit();

                return(buildingElements);
            }
        }
Пример #7
0
        public Primitive(DbElement cur)
        {
            this._primitive  = cur;
            this.Position    = cur.GetPosition((DbAttribute)DbAttributeInstance.POS, Tools.WrtQualifyer);
            this.Orientation = cur.GetOrientation((DbAttribute)DbAttributeInstance.ORI, Tools.WrtQualifyer);
            Direction direction1 = this.Orientation.XDir();
            Direction direction2 = this.Orientation.YDir();
            Direction direction3 = this.Orientation.ZDir();

            this.DirX      = IfcTools.CreateDirection(direction1.East, direction1.get_North(), direction1.get_Up());
            this.DirY      = IfcTools.CreateDirection(direction2.East(), direction2.get_North(), direction2.get_Up());
            this.DirZ      = IfcTools.CreateDirection(direction3.get_East(), direction3.get_North(), direction3.get_Up());
            this.Reference = cur.RefNo()[0].ToString() + "/" + (object)cur.RefNo()[1];
        }
Пример #8
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));
        }
Пример #9
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));
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
0
        public override List <IfcBuildingElement> ToBuildingElementIfc(IfcStore model)
        {
            using (var transaction = model.BeginTransaction("Create Mesh Element"))
            {
                MeshFaceList             faces                 = Mesh.Faces;
                MeshVertexList           vertices              = Mesh.Vertices;
                List <IfcCartesianPoint> ifcVertices           = IfcTools.VerticesToIfcCartesianPoints(model, vertices);
                IfcFaceBasedSurfaceModel faceBasedSurfaceModel = IfcTools.CreateIfcFaceBasedSurfaceModel(model, faces, ifcVertices);
                var shape = IfcTools.CreateIfcShapeRepresentation(model, "Mesh");
                shape.Items.Add(faceBasedSurfaceModel);
                var ifcRelAssociatesMaterial = IfcTools.CreateIfcRelAssociatesMaterial(model, Material.Name, Material.Grade);
                var buildingElements         = IfcTools.CreateBuildingElements(model, ElementType, Name, shape, InsertPlanes,
                                                                               ifcRelAssociatesMaterial);

                transaction.Commit();

                return(buildingElements);
            }
        }
Пример #13
0
        public MeshToElements(string name, Mesh mesh, Material material, int type, List <Plane> insertPlanes)
        {
            Name         = name;
            Mesh         = mesh;
            Material     = material;
            Amount       = insertPlanes.Count;
            Volume       = VolumeMassProperties.Compute(mesh).Volume *Amount;
            Mass         = Volume * material.Density;
            InsertPlanes = insertPlanes;
            ElementType  = IfcTools.IntToType(type);
            ResultMesh   = new List <Mesh>();

            foreach (var plane in InsertPlanes)
            {
                Mesh      duplicateMesh = Mesh.DuplicateMesh();
                Transform planeToPlane  = Transform.PlaneToPlane(Plane.WorldXY, plane);
                duplicateMesh.Transform(planeToPlane);
                ResultMesh.Add(duplicateMesh);
            }
        }
Пример #14
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);
        }
Пример #15
0
        public HierarchyItem(
            Mapping mapping,
            FileInfo ifcFile,
            string version,
            ProgressBar progressBar)
        {
            this._mapping     = mapping;
            this._version     = version;
            this._progressBar = progressBar;
            HierarchyItem.Log.Info((object)("Windows user    : "******"MAC Adress      : " + Tools.GetMacAddress()));
            HierarchyItem.Log.Info((object)("Mapping profile : " + this._mapping.MappingProfile.FullName));
            HierarchyItem.Log.Info((object)("Mapping material: " + this._mapping.MappingMaterial.FullName));
            HierarchyItem.Log.Info((object)("Mapping UDA     : " + this._mapping.MappingUda.FullName));
            Command command = Command.CreateCommand("VAR !!UNIT UNIT");

            command.Run();
            this._unit = command.GetPMLVariableString("UNIT");
            string[] strArray = this._unit.Split(' ');
            if (!strArray[0].ToUpper().Equals("MM"))
            {
                Command.CreateCommand("MM BORE").RunInPdms();
                HierarchyItem.Log.Info((object)"Bore temporary set to MM.");
            }
            if (!strArray[2].ToUpper().Equals("MM"))
            {
                Command.CreateCommand("MM DIST").RunInPdms();
                HierarchyItem.Log.Info((object)"Distance temporary set to MM.");
            }
            IfcTools.ClearDb();
            IfcDatabaseAPI ifcDatabase = IfcTools.IfcDatabase;

            IfcTools.SetupModel(ifcFile.FullName);
            List <DbElement> dbElementList1 = this.CollectStructuralItems();
            List <DbElement> dbElementList2 = this.CollectPrimitiveItems();
            List <DbElement> dbElementList3 = this.CollectPjoiItems();
            List <DbElement> dbElementList4 = this.CollectPipingItems();

            HierarchyItem.Log.Info((object)("Amount Structural Items       : " + (object)dbElementList1.Count));
            HierarchyItem.Log.Info((object)("Amount Primary joints         : " + (object)dbElementList3.Count));
            HierarchyItem.Log.Info((object)("Amount Primitive items (EQUI) : " + (object)dbElementList2.Count));
            HierarchyItem.Log.Info((object)("Amount Piping items (PIPE)    : " + (object)dbElementList4.Count));
            this._progressBar.Value = 0;
            int num = (int)Math.Floor(1000000.0 / (double)(dbElementList1.Count + dbElementList2.Count + dbElementList3.Count + dbElementList4.Count));
            List <IIfcProduct> elements = new List <IIfcProduct>();

            using (List <DbElement> .Enumerator enumerator = dbElementList1.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DbElement      current        = enumerator.Current;
                    StructuralItem structuralItem = new StructuralItem(mapping, "");
                    this._progressBar.Value += num;
                    this._progressBar.Update();
                    structuralItem.ExportPdmsItem(current, ref elements);
                }
            }
            dbElementList1.Clear();
            using (List <DbElement> .Enumerator enumerator = dbElementList4.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DbElement current = enumerator.Current;
                    this._progressBar.Value += num;
                    this._progressBar.Update();
                    this.ExportPipingItem(current, ref elements);
                }
            }
            dbElementList4.Clear();
            using (List <DbElement> .Enumerator enumerator = dbElementList2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DbElement      current        = enumerator.Current;
                    StructuralItem structuralItem = new StructuralItem(mapping, "");
                    this._progressBar.Value += num;
                    this._progressBar.Update();
                    structuralItem.ExportPrimitiveItem(current, ref elements);
                }
            }
            dbElementList2.Clear();
            using (List <DbElement> .Enumerator enumerator = dbElementList3.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DbElement      current        = enumerator.Current;
                    StructuralItem structuralItem = new StructuralItem(mapping, "");
                    this._progressBar.Value += num;
                    this._progressBar.Update();
                    structuralItem.ExportPjoiItem(current, ref elements);
                }
            }
            IfcTools.BindElementsToModel(elements);
            IfcTools.IfcDatabase.WriteModel(ifcFile.FullName);
            Command.CreateCommand(this._unit).RunInPdms();
            this._progressBar.Value = 0;
            this._progressBar.Refresh();
        }