Beispiel #1
0
        private static IfcBeam CreateBeam(XbimModel model, HndzStructuralElement genericProducthndz)
        {
            using (XbimReadWriteTransaction txn = model.BeginTransaction("Create" + genericProducthndz.ToString()))
            {
                IfcBeam genericProductIfc        = model.Instances.New <IfcBeam>();
                IfcExtrudedAreaSolid body        = model.Instances.New <IfcExtrudedAreaSolid>();
                IfcBeamType          elementType = model.Instances.New <IfcBeamType>();
                elementType.PredefinedType = IfcBeamTypeEnum.BEAM;


                if (genericProducthndz.Profile is HndzRectangularProfile)
                {
                    HndzRectangularProfile genericProfilehndz = genericProducthndz.Profile as HndzRectangularProfile;

                    IfcRectangleProfileDef ifcGenericProfile = AssignRectangularProfile(model, genericProducthndz, genericProductIfc, elementType, genericProfilehndz);

                    //model as a swept area solid
                    body.SweptArea = ifcGenericProfile;
                }

                if (genericProducthndz.Profile is HndzISectionProfile)
                {
                    HndzISectionProfile genericProfilehndz = genericProducthndz.Profile as HndzISectionProfile;

                    IfcIShapeProfileDef ifcGenericProfile = AssignIProfile(model, genericProducthndz, genericProductIfc, elementType, genericProfilehndz);


                    //model as a swept area solid
                    body.SweptArea = ifcGenericProfile;
                }
                if (genericProducthndz.Profile is HndzCSectionProfile)
                {
                    HndzCSectionProfile genericProfilehndz = genericProducthndz.Profile as HndzCSectionProfile;
                    IfcCShapeProfileDef ifcGenericProfile  = AssignCsectionProfile(model, genericProducthndz, genericProductIfc, elementType, genericProfilehndz);


                    //model as a swept area solid
                    body.SweptArea = ifcGenericProfile;
                }

                AdjustExtrusion(model, body, genericProducthndz, genericProductIfc);

                if (model.Validate(txn.Modified(), Console.Out) == 0)
                {
                    txn.Commit();
                    return(genericProductIfc);
                }

                return(null);
            }
        }
Beispiel #2
0
        private static IfcIShapeProfileDef AssignIProfile(XbimModel model, HndzStructuralElement genericProducthndz,
                                                          IfcProduct genericProductIfc, IfcBuildingElementType elementType, HndzISectionProfile gnericProfileHndz)
        {
            #region Type & Material &Tags

            string typeText = genericProducthndz.ToString() + "I beam (flange " + gnericProfileHndz.I_Section.b_f + " x " + gnericProfileHndz.I_Section.t_fTop + " and web "
                              + gnericProfileHndz.I_Section.d + " x " + gnericProfileHndz.I_Section.t_w + " mm";


            elementType.Tag  = typeText;
            elementType.Name = typeText;
            IfcLabel columnLabel = new IfcLabel(typeText);
            elementType.ElementType          = columnLabel;
            elementType.ApplicableOccurrence = columnLabel;



            //genericProductIfc.Tag = typeText;
            genericProductIfc.Name        = typeText;
            genericProductIfc.Description = typeText;
            genericProductIfc.SetDefiningType(elementType, model);

            #endregion

            IfcIShapeProfileDef ifcGenericProfile = model.Instances.New <IfcIShapeProfileDef>();
            ifcGenericProfile.FlangeThickness = gnericProfileHndz.I_Section.tf;
            ifcGenericProfile.WebThickness    = gnericProfileHndz.I_Section.t_w;
            ifcGenericProfile.OverallWidth    = gnericProfileHndz.I_Section.b_f;
            ifcGenericProfile.OverallDepth    = gnericProfileHndz.I_Section.d;
            ifcGenericProfile.FilletRadius    = 10;//ToDo:make it zero after explore ISection

            ifcGenericProfile.ProfileType           = IfcProfileTypeEnum.AREA;
            ifcGenericProfile.Position              = model.Instances.New <IfcAxis2Placement2D>();
            ifcGenericProfile.Position.RefDirection = model.Instances.New <IfcDirection>();
            ifcGenericProfile.Position.RefDirection.SetXY(gnericProfileHndz.OrientationInPlane.X, gnericProfileHndz.OrientationInPlane.Y);
            ifcGenericProfile.Position.Location = model.Instances.New <IfcCartesianPoint>();
            ifcGenericProfile.Position.Location.SetXY(0, 0);
            //ifcGenericProfile.Position.Location.SetXY(genericProducthndz.ExtrusionLine.baseNode.Point.X,
            //     genericProducthndz.ExtrusionLine.baseNode.Point.Y);
            return(ifcGenericProfile);
        }
Beispiel #3
0
        private static IfcCShapeProfileDef AssignCsectionProfile(XbimModel model, HndzStructuralElement genericProducthndz,
                                                                 IfcProduct genericProductIfc, IfcBuildingElementType elementType, HndzCSectionProfile genericProfilehndz)
        {
            #region Type & Material &Tags

            string typeText = genericProducthndz.ToString() + " C-Chanel (flange " + genericProfilehndz.C_Section.b_f + " x " + genericProfilehndz.C_Section.t_f + " and web "
                              + genericProfilehndz.C_Section.d + " x " + genericProfilehndz.C_Section.t_w + " mm";


            elementType.Tag  = typeText;
            elementType.Name = typeText;
            IfcLabel columnLabel = new IfcLabel(typeText);
            elementType.ElementType          = columnLabel;
            elementType.ApplicableOccurrence = columnLabel;


            //genericProductIfc.Tag = typeText;
            genericProductIfc.Name        = typeText;
            genericProductIfc.Description = typeText;
            genericProductIfc.SetDefiningType(elementType, model);

            #endregion

            IfcCShapeProfileDef ifcGenericProfile = model.Instances.New <IfcCShapeProfileDef>();
            ifcGenericProfile.ProfileType   = IfcProfileTypeEnum.AREA;
            ifcGenericProfile.WallThickness = genericProfilehndz.C_Section.t_f;
            //MyColumnPofile.WebThickness = Iprofile.C_Section.t_w; //ToDo:purlin web and flange thickness are the same!!!!
            ifcGenericProfile.Width = genericProfilehndz.C_Section.b_f;
            ifcGenericProfile.Depth = genericProfilehndz.C_Section.d;
            ifcGenericProfile.Girth = 5;//ToDo:What's that
            ifcGenericProfile.InternalFilletRadius = 10;

            ifcGenericProfile.Position = model.Instances.New <IfcAxis2Placement2D>();
            ifcGenericProfile.Position.RefDirection = model.Instances.New <IfcDirection>();
            ifcGenericProfile.Position.RefDirection.SetXY(genericProfilehndz.OrientationInPlane.X, genericProfilehndz.OrientationInPlane.Y);
            ifcGenericProfile.Position.Location = model.Instances.New <IfcCartesianPoint>();
            ifcGenericProfile.Position.Location.SetXY(0, 0);
            return(ifcGenericProfile);
        }
Beispiel #4
0
        public void ConvertToHndzElement(HndzStructuralElement hndzElement)
        {
            SAPITaperedSection sapSec = (SAPITaperedSection)Section;

            //HndzStructuralElement hndzElement;
            SectionI startSec = new SectionI(sapSec.StartSection.Name, sapSec.StartSection.Height * 1000, sapSec.StartSection.BotFlangeWidth * 1000, sapSec.StartSection.BotFlangeThickness * 1000, sapSec.StartSection.WebThickness * 1000);
            SectionI endSec   = new SectionI(sapSec.EndSection.Name, sapSec.EndSection.Height * 1000, sapSec.EndSection.BotFlangeWidth * 1000, sapSec.EndSection.BotFlangeThickness * 1000, sapSec.EndSection.WebThickness * 1000);

            if (hndzElement.Profile is HndzITaperedProfile)
            {
                HndzITaperedProfile profile = hndzElement.Profile as HndzITaperedProfile;
                hndzElement.Name               = Name;
                hndzElement.Profile.Name       = Name;
                profile.StartProfile.I_Section = startSec;
                profile.StartProfile.Name      = sapSec.StartSection.Name;
                profile.EndProfile.I_Section   = endSec;
                profile.EndProfile.Name        = sapSec.EndSection.Name;
            }

            hndzElement.AnalysisResults         = new HndzAnalysisResults[AnalysisResults.NumberResults];
            hndzElement.AnalysisResultsEnvelope = new HndzAnalysisResults[AnalysisResultsEnvelope.NumberResults];

            for (int i = 0; i < AnalysisResults.NumberResults; i++)
            {
                hndzElement.AnalysisResults[i] = new HndzAnalysisResults(AnalysisResults.Station[i],
                                                                         AnalysisResults.LoadCase[i], AnalysisResults.Axial[i], AnalysisResults.Shear2[i], AnalysisResults.Shear3[i], AnalysisResults.TortionalMoment[i]
                                                                         , AnalysisResults.Moment2[i], AnalysisResults.Moment3[i]);
            }
            for (int i = 0; i < AnalysisResultsEnvelope.NumberResults; i++)
            {
                hndzElement.AnalysisResultsEnvelope[i] = new HndzAnalysisResults(AnalysisResultsEnvelope.Station[i],
                                                                                 AnalysisResultsEnvelope.LoadCase[i], AnalysisResultsEnvelope.Axial[i], AnalysisResultsEnvelope.Shear2[i], AnalysisResultsEnvelope.Shear3[i], AnalysisResultsEnvelope.TortionalMoment[i]
                                                                                 , AnalysisResultsEnvelope.Moment2[i], AnalysisResultsEnvelope.Moment3[i]);
            }
            hndzElement.IsDesignPassed = IsDesignPassed;
            //TODO: Section and material
            //return hndzElement;
        }
Beispiel #5
0
        private static IfcRectangleProfileDef AssignRectangularProfile(XbimModel model, HndzStructuralElement genericProducthndz,
                                                                       IfcProduct genericProductIfc, IfcBuildingElementType elementType, HndzRectangularProfile genericProfilehndz)
        {
            #region Type & Material &Tags

            string typeText = genericProducthndz.ToString() + (int)genericProfilehndz.Rectangle.Width + " x "
                              + (int)genericProfilehndz.Rectangle.Height + " mm";

            elementType.Tag  = typeText;
            elementType.Name = typeText;
            IfcLabel columnLabel = new IfcLabel(typeText);
            elementType.ElementType          = columnLabel;
            elementType.ApplicableOccurrence = columnLabel;



            //genericProductIfc.Tag = typeText;
            genericProductIfc.Name        = typeText;
            genericProductIfc.Description = typeText;
            genericProductIfc.SetDefiningType(elementType, model);

            #endregion

            //represent column as a rectangular profile
            IfcRectangleProfileDef ifcGenericProfile = model.Instances.New <IfcRectangleProfileDef>();
            ifcGenericProfile.ProfileType = IfcProfileTypeEnum.AREA;
            ifcGenericProfile.XDim        = genericProfilehndz.Rectangle.Height;
            ifcGenericProfile.YDim        = genericProfilehndz.Rectangle.Width;

            ifcGenericProfile.Position = model.Instances.New <IfcAxis2Placement2D>();
            ifcGenericProfile.Position.RefDirection = model.Instances.New <IfcDirection>();
            ifcGenericProfile.Position.RefDirection.SetXY(genericProfilehndz.OrientationInPlane.X, genericProfilehndz.OrientationInPlane.Y);
            ifcGenericProfile.Position.Location = model.Instances.New <IfcCartesianPoint>();
            ifcGenericProfile.Position.Location.SetXY(0, 0);
            return(ifcGenericProfile);
        }
Beispiel #6
0
        private static void AdjustExtrusion(XbimModel model, IfcExtrudedAreaSolid body, HndzStructuralElement genericProducthndz,
                                            IfcProduct genericProductIfc)
        {
            IfcCartesianPoint axisOrigin = model.Instances.New <IfcCartesianPoint>();

            axisOrigin.SetXYZ(0, 0, 0);

            IfcCartesianPoint elementStartPoint = model.Instances.New <IfcCartesianPoint>();

            elementStartPoint.SetXYZ(genericProducthndz.ExtrusionLine.baseNode.Point.X,
                                     genericProducthndz.ExtrusionLine.baseNode.Point.Y, genericProducthndz.ExtrusionLine.baseNode.Point.Z); //insert at arbitrary position//****************Need Revision


            body.Depth             = genericProducthndz.ExtrusionLine.RhinoLine.Length;
            body.ExtrudedDirection = model.Instances.New <IfcDirection>();
            body.ExtrudedDirection.SetXYZ(0, 0, 1);

            //parameters to insert the geometry in the model

            body.Position          = model.Instances.New <IfcAxis2Placement3D>();
            body.Position.Location = axisOrigin;

            //body.Position.RefDirection = model.Instances.New<IfcDirection>();
            //body.Position.RefDirection.SetXYZ(1, 0, 0);

            //Create a Definition shape to hold the geometry
            IfcShapeRepresentation shape = model.Instances.New <IfcShapeRepresentation>();

            shape.ContextOfItems           = model.IfcProject.ModelContext();
            shape.RepresentationType       = "SweptSolid";
            shape.RepresentationIdentifier = "Body";
            shape.Items.Add(body);

            //Create a Product Definition and add the model geometry to the wall
            IfcProductDefinitionShape rep = model.Instances.New <IfcProductDefinitionShape>();

            rep.Representations.Add(shape);
            genericProductIfc.Representation = rep;

            //now place the wall into the model
            #region ProfileVectorDir.

            Vector3d perpendicularVector = new Vector3d(genericProducthndz.Profile.OrientationInPlane.X, genericProducthndz.Profile.OrientationInPlane.Y, 0);
            Plane    extrusionPlane;

            bool aa = genericProducthndz.ExtrusionLine.RhinoLine.TryGetPlane(out extrusionPlane);
            if (aa)
            {
                perpendicularVector = extrusionPlane.ZAxis;
            }

            // Vector3d elementDirection = genericProducthndz.ExtrusionLine.RhinoLine.Direction;
            //Plane profilePlane = new Plane(genericProducthndz.ExtrusionLine.baseNode.Point, elementDirection);
            // Vector3d profileXdirection = profilePlane.XAxis;

            #endregion
            IfcLocalPlacement   lp   = model.Instances.New <IfcLocalPlacement>();
            IfcAxis2Placement3D ax3D = model.Instances.New <IfcAxis2Placement3D>();
            ax3D.Location     = elementStartPoint;
            ax3D.RefDirection = model.Instances.New <IfcDirection>();
            ax3D.RefDirection.SetXYZ(perpendicularVector.X, perpendicularVector.Y, perpendicularVector.Z);  //Y-Axis
            //ax3D.RefDirection.SetXYZ(0, 1, 0);  //Y-Axis
            ax3D.Axis = model.Instances.New <IfcDirection>();
            ax3D.Axis.SetXYZ(genericProducthndz.ExtrusionLine.RhinoLine.Direction.X, genericProducthndz.ExtrusionLine.RhinoLine.Direction.Y, genericProducthndz.ExtrusionLine.RhinoLine.Direction.Z);          //Z-Axis


            //XbimVector3D X_Dir = new XbimVector3D(extrusionPlane.XAxis.X, extrusionPlane.XAxis.Y, extrusionPlane.XAxis.Z);
            //XbimVector3D Y_Dir = new XbimVector3D(extrusionPlane.YAxis.X, extrusionPlane.YAxis.Y, extrusionPlane.YAxis.Z);
            //XbimVector3D Z_Dir = new XbimVector3D(extrusionPlane.ZAxis.X, extrusionPlane.ZAxis.Y, extrusionPlane.ZAxis.Z);
            //ax3D.P.Insert(0,X_Dir);
            //ax3D.P.Insert(1,Y_Dir);
            //ax3D.P.Insert(2,Z_Dir);

            lp.RelativePlacement = ax3D;
            genericProductIfc.ObjectPlacement = lp;

            // Where Clause: The IfcWallStandard relies on the provision of an IfcMaterialLayerSetUsage
            IfcMaterialLayerSetUsage ifcMaterialLayerSetUsage = model.Instances.New <IfcMaterialLayerSetUsage>();
            IfcMaterialLayerSet      ifcMaterialLayerSet      = model.Instances.New <IfcMaterialLayerSet>();
            IfcMaterialLayer         ifcMaterialLayer         = model.Instances.New <IfcMaterialLayer>();
            ifcMaterialLayer.LayerThickness = 10;
            ifcMaterialLayerSet.MaterialLayers.Add(ifcMaterialLayer);
            ifcMaterialLayerSetUsage.ForLayerSet             = ifcMaterialLayerSet;
            ifcMaterialLayerSetUsage.LayerSetDirection       = IfcLayerSetDirectionEnum.AXIS2;
            ifcMaterialLayerSetUsage.DirectionSense          = IfcDirectionSenseEnum.NEGATIVE;
            ifcMaterialLayerSetUsage.OffsetFromReferenceLine = 150;

            // Add material to wall
            IfcMaterial material = model.Instances.New <IfcMaterial>();
            material.Name = "STEEL";
            IfcRelAssociatesMaterial ifcRelAssociatesMaterial = model.Instances.New <IfcRelAssociatesMaterial>();
            ifcRelAssociatesMaterial.RelatingMaterial = material;
            ifcRelAssociatesMaterial.RelatedObjects.Add(genericProductIfc);

            ifcRelAssociatesMaterial.RelatingMaterial = ifcMaterialLayerSetUsage;

            // IfcPresentationLayerAssignment is required for CAD presentation in IfcWall or IfcWallStandardCase
            IfcPresentationLayerAssignment ifcPresentationLayerAssignment = model.Instances.New <IfcPresentationLayerAssignment>();
            ifcPresentationLayerAssignment.Name = "HANDZteel Assignment";
            ifcPresentationLayerAssignment.AssignedItems.Add(shape);


            // linear segment as IfcPolyline with two points is required for IfcWall
            IfcPolyline       ifcPolyline = model.Instances.New <IfcPolyline>();
            IfcCartesianPoint startPoint  = model.Instances.New <IfcCartesianPoint>();
            startPoint.SetXY(genericProducthndz.ExtrusionLine.baseNode.Point.X, genericProducthndz.ExtrusionLine.baseNode.Point.Y);
            IfcCartesianPoint endPoint = model.Instances.New <IfcCartesianPoint>();
            endPoint.SetXY(genericProducthndz.ExtrusionLine.EndNode.Point.X, genericProducthndz.ExtrusionLine.EndNode.Point.Y);
            ifcPolyline.Points.Add(startPoint);
            ifcPolyline.Points.Add(endPoint);

            IfcShapeRepresentation shape2D = model.Instances.New <IfcShapeRepresentation>();
            shape2D.ContextOfItems           = model.IfcProject.ModelContext();
            shape2D.RepresentationIdentifier = "Axis";
            shape2D.RepresentationType       = "Curve2D";
            shape2D.Items.Add(ifcPolyline);
            rep.Representations.Add(shape2D);
        }