//		public static IfcProductDefinitionShape Create(IfcRepresentationContext representationContext,
//		                                               IfcProfileDef ifcProfileDef,
//		                                               IfcAxis2Placement3D placement3D,
//		                                               IfcDirection direction,
//		                                               double depth)
//		{
//			var extruded = new IfcExtrudedAreaSolid
//			{
//				SweptArea = ifcProfileDef,
//				Position =  placement3D,
//				ExtrudedDirection = direction ,
//				Depth = depth,
//			};
//
//			var shaperep = new IfcShapeRepresentation
//			{
//				ContextOfItems = representationContext,
//				RepresentationIdentifier = "Body",
//				RepresentationType = "SweptSolid",
//				Items = new List<IfcRepresentationItem>(),
//			};
//			shaperep.Items.Add(extruded);
//
//			var ifcShape = new IfcProductDefinitionShape
//			{
//				// Name=
//				// Description =
//				Representations = new List<IfcRepresentation>(),
//			};
//			ifcShape.Representations.Add(shaperep);
//
//			return ifcShape;
//		}
//
//


        public static BbExtrudedGeometry RetrieveFromMainPiece(BbElement mainPiece)
        {
            var ret  = new BbExtrudedGeometry();
            var ipds = mainPiece.IfcObject as IfcElement;
            var iPDS = ipds.Representation as IfcProductDefinitionShape;
            var reps = iPDS.Representations;

            foreach (var rep in reps)
            {
                var iSR      = rep as IfcShapeRepresentation;
                var repItems = rep.Items;
                foreach (var repItem in repItems)
                {
                    var ExtGeo = repItem as IfcExtrudedAreaSolid;
                    if (ExtGeo == null)
                    {
                        continue;
                    }
                    var semExGeo = new BbExtrudedGeometry {
                        IfcGeometricRepresentationItem = ExtGeo, _ifcProductDefinitionShape = iPDS, _ifcShapeRepresentation = iSR
                    };
                    BbInstanceDB.AddToExport(semExGeo);
                    //var profile = BbProfile.Retrieve(semExGeo);
                    //mainPiece.Profile = profile;
                    ret = semExGeo;
                }
            }
            return(ret);
        }
//		ExtrudedElement(
//			string name,
//			Profile profile,
//			double length,
//			Coordinate3D position,
//			Direction3D zAxis,
//			Direction3D xAxis,
//			Direction3D extrudeDirection,
//			Element container)
//			:this (name, profile, length, position, zAxis, xAxis, extrudeDirection,
//			       container.ObjectLocalPlacement, container.IfcElement.OwnerHistory)
//		{}
//
//		ExtrudedElement(
//			string name,
//			Profile profile,
//			double length,
//			Coordinate3D position,
//			Direction3D zAxis,
//			Direction3D xAxis,
//			Direction3D extrudeDirection,
//			SpatialElement container)
//			:this (name, profile, length, position, zAxis, xAxis, extrudeDirection,
//			       container.ObjectLocalPlacement, container.IfcSpatialStructureElement.OwnerHistory)
//		{}

        BbExtrudedElement(
            string name,
            BbProfile profile,
            double length,
            BbCoordinate3D position,
            BbDirection3D zAxis,
            BbDirection3D xAxis,
            BbDirection3D extrudeDirection,
            BbLocalPlacement3D containerLocation,
            IfcOwnerHistory ownerHistory,
            Type ifcEntityType)
        {
            Name    = name;
            Profile = profile;
            Length  = length;
            BbPosition3D pos = BbPosition3D.Create(position, zAxis, xAxis);

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                containerLocation, pos);

            BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                BbHeaderSetting.Setting3D.ZAxis,
                Length);

            _ifcElement              = Activator.CreateInstance(ifcEntityType) as IfcElement;
            _ifcElement.GlobalId     = IfcGloballyUniqueId.NewGuid();
            _ifcElement.OwnerHistory = ownerHistory;
            _ifcElement.Name         = Name;
            //ObjectType = ,
            _ifcElement.ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement;
            _ifcElement.Representation  = bbExtrudedGeometry.IfcProductDefinitionShape;
        }
Exemple #3
0
        private BbPiece(string name, string objectType, BbProfile profile,
                        double length, BbCoordinate3D position, BbDirection3D zAxis,
                        BbDirection3D xAxis, BbDirection3D extrudeDirection,
                        BbLocalPlacement3D hostPlacement, Type ifcEntityType)
        {
            Length  = length;
            Profile = profile;
            var pos = BbPosition3D.Create(position, zAxis, xAxis);

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                hostPlacement, pos);

            var semExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                extrudeDirection,
                Length);

            _ifcElement = Activator.CreateInstance(ifcEntityType) as IfcElement;
            if (_ifcElement == null)
            {
                return;
            }

            _ifcElement.GlobalId        = IfcGloballyUniqueId.ConvertToIfcGuid(Guid);
            _ifcElement.OwnerHistory    = BbHeaderSetting.Setting3D.IfcOwnerHistory;
            _ifcElement.Name            = name;
            _ifcElement.ObjectType      = objectType;
            _ifcElement.ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement;
            _ifcElement.Representation  = semExtrudedGeometry.IfcProductDefinitionShape;
            //_ifcElement.Tag = id;
        }
Exemple #4
0
        public BbCutCope(
            BbElement hostElement,
            BbProfile profile,
            double length,
            double[] zAxis,
            double[] xAxis,
            double[] extrudeDirection,
            double[] position)
        {
            //ObjectLocalPlacement = new LocalPlacement3D(hostElement.ObjectLocalPlacement, new Position3D(position));

            /// from main piece
            BbPosition3D pos = BbPosition3D.Create(
                BbCoordinate3D.Create(position),
                BbDirection3D.Create(zAxis),
                BbDirection3D.Create(xAxis));

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                hostElement.ObjectBbLocalPlacement, pos);

            BbDirection3D exDir;

            if (Math.Round(extrudeDirection[0], 8) == 0.0 && Math.Round(extrudeDirection[0], 8) == 0 && Math.Round(extrudeDirection[0], 8) == 1)
            {
                exDir = BbHeaderSetting.Setting3D.ZAxis;
            }
            else
            {
                exDir = BbDirection3D.Create(extrudeDirection);
            }


            BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                exDir,
                length);

            _ifcOpeningElement = new IfcOpeningElement
            {
                GlobalId     = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory = hostElement.IfcObject.OwnerHistory,
                // Name =
                // Description =
                ObjectType      = "Opening",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                Representation  = bbExtrudedGeometry.IfcProductDefinitionShape,
            };

            _ifcRelVoidsElement = new IfcRelVoidsElement
            {
                GlobalId                = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory            = hostElement.IfcObject.OwnerHistory,
                Name                    = "Cope",
                RelatingBuildingElement = hostElement.IfcObject as IfcElement,
                RelatedOpeningElement   = _ifcOpeningElement,
            };
        }
 /// <summary>
 /// wrong implementation
 /// </summary>
 /// <param name="extrudedGeometry"></param>
 /// <returns></returns>
 public static BbNamedRectangleProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
 {
     var ret = new BbNamedRectangleProfile();
     //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcRectangleProfileDef;
     //var semRProfile = new BbNamedRectangleProfile { IfcProfileDef = profileDef };
     //BbInstanceDB.AddToExport(semRProfile);
     //ret = semRProfile;
     return ret;
 }
Exemple #6
0
        /// <summary>
        /// wrong implementation
        /// </summary>
        /// <param name="extrudedGeometry"></param>
        /// <returns></returns>
        public static BbCopeProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
        {
            var ret = new BbCopeProfile();

            //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcArbitraryClosedProfileDef;
            //var semCoProfile = new BbCopeProfile { IfcProfileDef = profileDef };
            //BbInstanceDB.AddToExport(semCoProfile);
            //ret = semCoProfile;
            return(ret);
        }
Exemple #7
0
        /// <summary>
        /// wrong implementation
        /// </summary>
        /// <param name="extrudedGeometry"></param>
        /// <returns></returns>
        public static BbBbNamedCircleProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
        {
            var ret = new BbBbNamedCircleProfile();

            //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcCircleProfileDef;
            //var semCiProfile = new BbBbNamedCircleProfile { IfcProfileDef = profileDef };
            //BbInstanceDB.AddToExport(semCiProfile);
            //ret = semCiProfile;
            return(ret);
        }
Exemple #8
0
        /// <summary>
        /// wrong implementation
        /// </summary>
        /// <param name="extrudedGeometry"></param>
        /// <returns></returns>
        public static BbNamedIProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
        {
            var ret = new BbNamedIProfile();

            //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcIShapeProfileDef;
            //var semHProfile = new BbNamedIProfile { IfcProfileDef = profileDef };
            ////BbInstanceDB.Add(semHProfile);
            //ret = semHProfile;
            return(ret);
        }
        public static BbExtrudedGeometry Create(
            BbProfile profile,
            BbPosition3D position3D,
            BbDirection3D direction3D,
            double depth)
        {
            var extrudedGeometry = new BbExtrudedGeometry(profile,
                                                          position3D,
                                                          direction3D,
                                                          depth);

            return(extrudedGeometry);
        }
Exemple #10
0
        public BbCutCope(
            BbElement hostElement,
            double copeWidth,
            double copeDepth,
            double copeRadius,
            double[] position)
        {
            BbCopeProfile profile = BbCopeProfile.Create(copeWidth, copeDepth, copeRadius);

            var mainPart = hostElement as BbPiece;

            if (mainPart == null)
            {
                return;
            }

            BbPosition3D pos = BbPosition3D.Create(
                BbCoordinate3D.Create(position),
                BbHeaderSetting.Setting3D.XAxisMinus,
                BbHeaderSetting.Setting3D.ZAxis);

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                hostElement.ObjectBbLocalPlacement, pos);

            BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                BbHeaderSetting.Setting3D.ZAxis,
                mainPart.Profile.Width);

            _ifcOpeningElement = new IfcOpeningElement
            {
                GlobalId     = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory = hostElement.IfcObject.OwnerHistory,
                // Name =
                // Description =
                ObjectType      = "Opening",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                Representation  = bbExtrudedGeometry.IfcProductDefinitionShape,
            };

            _ifcRelVoidsElement = new IfcRelVoidsElement
            {
                GlobalId                = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory            = hostElement.IfcObject.OwnerHistory,
                Name                    = "Cope",
                RelatingBuildingElement = hostElement.IfcObject as IfcElement,
                RelatedOpeningElement   = _ifcOpeningElement,
            };
        }
Exemple #11
0
        /// <summary>
        /// wrong implmentation
        /// </summary>
        /// <param name="extrudedGeometry"></param>
        /// <returns></returns>
        public static BbDerivedProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
        {
            var ret = new BbDerivedProfile();

            //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcDerivedProfileDef;
            //var semDProfile = new BbDerivedProfile { IfcProfileDef = profileDef };

            ////Retrieving ParentProfile
            //var parent = profileDef.ParentProfile;
            //if (parent.GetType() == typeof(IfcIShapeProfileDef))
            //{ var parentProfile = BbNamedIProfile.Retrieve(extrudedGeometry); }
            //if (parent.GetType() == typeof(IfcLShapeProfileDef))
            //{ var parentProfile = BbNamedLProfile.Retrieve(extrudedGeometry); }

            ////BbInstanceDB.Add(semLProfile);
            //ret = semDProfile;
            return(ret);
        }
        public static BbExtrudedGeometry RetrieveFromFeature(BbFeature feature)
        {
            var ret = new BbExtrudedGeometry();

            // need modification
            //var pDS = feature.IfcOpeningElement.Representation as IfcProductDefinitionShape;
            //var representations = pDS.Representations;
            //foreach (var representation in representations)
            //{
            //    var sR = representation as IfcShapeRepresentation;
            //    var repItems = representation.Items;
            //    foreach (var repItem in repItems)
            //    {
            //        var eAS = repItem as IfcExtrudedAreaSolid;
            //        var semExtudedGeometry = new BbExtrudedGeometry { _ifcProductDefinitionShape = pDS, IfcGeometricRepresentationItem = eAS, _ifcShapeRepresentation = sR };
            //        ret = semExtudedGeometry;
            //    }
            //}
            return(ret);
        }
Exemple #13
0
        BbSkewedEnd(
            BbElement hostElement,
            BbPosition3D pos)
        {
            var mainPart = hostElement as BbPiece;

            if (mainPart == null)
            {
                return;
            }

            var width = mainPart.Length > mainPart.Profile.Width ? mainPart.Length : mainPart.Profile.Width;

            width = width * 100;
            var depth = mainPart.Length > mainPart.Profile.Depth ? mainPart.Length : mainPart.Profile.Depth;

            depth = depth * 100;
            var profile = BbNamedRectangleProfile.Create(width, depth);

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                hostElement.ObjectBbLocalPlacement, pos);



            //Direction3D exDir = Direction3D.Create(new[] {pos.Axis.X, pos.Axis.Y, pos.Axis.Z});

            BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                BbHeaderSetting.Setting3D.ZAxis,
                mainPart.Length);


            //IfcHalfSpaceSolid ifcHalfSpaceSolid = new IfcHalfSpaceSolid
            //    {
            //        BaseSurface = new IfcPlane
            //            {
            //                Position = pos.IfcAxis2Placement3D,
            //            },
            //            AgreementFlag = true,

            //    };

            //IfcShapeRepresentation ifcShapeRepresentation = new IfcShapeRepresentation
            //{
            //    ContextOfItems = HeaderSetting.Setting3D.GeometricRepresentationContext,
            //    RepresentationIdentifier = "Body",
            //    RepresentationType = "SweptSolid",
            //    //RepresentationIdentifier = "Body",
            //    //RepresentationType = "SolidModel",
            //    Items = new List<IfcRepresentationItem>(),
            //};
            //ifcShapeRepresentation.Items.Add(ifcHalfSpaceSolid);

            //IfcProductDefinitionShape ifcProductDefinitionShape = new IfcProductDefinitionShape
            //{
            //    // Name=
            //    // Description =
            //    Representations = new List<IfcRepresentation>(),
            //};
            //ifcProductDefinitionShape.Representations.Add(ifcShapeRepresentation);

            _ifcOpeningElement = new IfcOpeningElement
            {
                GlobalId     = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory = hostElement.IfcObject.OwnerHistory,
                // Name =
                // Description =
                ObjectType      = "Opening",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                Representation  = bbExtrudedGeometry.IfcProductDefinitionShape,
                //Representation = ifcProductDefinitionShape,
            };

            _ifcRelVoidsElement = new IfcRelVoidsElement
            {
                GlobalId                = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory            = hostElement.IfcObject.OwnerHistory,
                Name                    = "Skewed End",
                RelatingBuildingElement = hostElement.IfcObject as IfcElement,
                RelatedOpeningElement   = _ifcOpeningElement,
            };
        }
        /// <summary>
        /// wrong implmentation
        /// </summary>
        /// <param name="extrudedGeometry"></param>
        /// <returns></returns>
        public static BbDerivedProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
        {
            var ret = new BbDerivedProfile();
            //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcDerivedProfileDef;
            //var semDProfile = new BbDerivedProfile { IfcProfileDef = profileDef };

            ////Retrieving ParentProfile
            //var parent = profileDef.ParentProfile;
            //if (parent.GetType() == typeof(IfcIShapeProfileDef))
            //{ var parentProfile = BbNamedIProfile.Retrieve(extrudedGeometry); }
            //if (parent.GetType() == typeof(IfcLShapeProfileDef))
            //{ var parentProfile = BbNamedLProfile.Retrieve(extrudedGeometry); }

            ////BbInstanceDB.Add(semLProfile);
            //ret = semDProfile;
            return ret;
        }
Exemple #15
0
        protected BbOpening(
            BbElement hostElement,
            BbCoordinate2D position,
            BbProfile profile,
            SemHoleLocation location,
            bool through,
            string type
            )
        {
            var mainPart = hostElement as BbPiece;

            if (mainPart == null)
            {
                return;
            }


            double       thickness;
            BbPosition3D pos;

            // x direction follows extrusion direction
            // extrude origin  projected to bottom or left becomes the origin

            switch (location)
            {
            case SemHoleLocation.Left:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(
                        -(mainPart.Profile.Width / 2),
                        position.Y,
                        position.X),
                    BbHeaderSetting.Setting3D.XAxis,
                    BbHeaderSetting.Setting3D.ZAxis);
                if (through)
                {
                    thickness = mainPart.Profile.Width;
                }
                else
                {
                    thickness = mainPart.Profile.Width / 2;
                }
                break;

            case SemHoleLocation.Right:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(
                        (mainPart.Profile.Width / 2),
                        position.Y,
                        position.X),
                    BbHeaderSetting.Setting3D.XAxisMinus,
                    BbHeaderSetting.Setting3D.ZAxis);
                if (through)
                {
                    thickness = mainPart.Profile.Width;
                }
                else
                {
                    thickness = mainPart.Profile.Width / 2;
                }
                break;

            case SemHoleLocation.Web:
                if (through)
                {
                    pos = BbPosition3D.Create(
                        BbCoordinate3D.Create(
                            (mainPart.Profile.Width / 2),
                            position.Y,
                            position.X
                            ),
                        BbHeaderSetting.Setting3D.XAxisMinus,
                        BbHeaderSetting.Setting3D.ZAxis);
                    thickness = mainPart.Profile.Width;
                }
                else
                {
                    pos = BbPosition3D.Create(
                        BbCoordinate3D.Create(
                            (mainPart.Profile.Width / 4),
                            position.Y,
                            position.X
                            ),
                        BbHeaderSetting.Setting3D.XAxisMinus,
                        BbHeaderSetting.Setting3D.ZAxis);
                    thickness = mainPart.Profile.Width / 2;
                }
                break;

            case SemHoleLocation.Bottom:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(
                        position.Y,
                        -(mainPart.Profile.Depth / 2),
                        position.X
                        ),
                    BbHeaderSetting.Setting3D.YAxis,
                    BbHeaderSetting.Setting3D.ZAxis);
                if (through)
                {
                    thickness = mainPart.Profile.Depth;
                }
                else
                {
                    thickness = mainPart.Profile.Depth / 2;
                }
                break;

            case SemHoleLocation.Top:
            default:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(
                        position.Y,
                        (mainPart.Profile.Depth / 2),
                        position.X
                        ),
                    BbHeaderSetting.Setting3D.YAxisMinus,
                    BbHeaderSetting.Setting3D.ZAxis);
                if (through)
                {
                    thickness = mainPart.Profile.Depth;
                }
                else
                {
                    thickness = mainPart.Profile.Depth / 2;
                }
                break;
            }

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                hostElement.ObjectBbLocalPlacement, pos);

            BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                BbHeaderSetting.Setting3D.ZAxis,
                thickness);

            _ifcOpeningElement = new IfcOpeningElement
            {
                GlobalId     = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory = hostElement.IfcObject.OwnerHistory,
                // Name =
                // Description =
                ObjectType      = "Opening",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                Representation  = bbExtrudedGeometry.IfcProductDefinitionShape,
            };

            _ifcRelVoidsElement = new IfcRelVoidsElement
            {
                GlobalId                = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory            = hostElement.IfcObject.OwnerHistory,
                Name                    = type,
                RelatingBuildingElement = hostElement.IfcObject as IfcElement,
                RelatedOpeningElement   = _ifcOpeningElement,
            };
        }
 //        public static IfcProductDefinitionShape Create(IfcRepresentationContext representationContext,
 //                                                       IfcProfileDef ifcProfileDef,
 //                                                       IfcAxis2Placement3D placement3D,
 //                                                       IfcDirection direction,
 //                                                       double depth)
 //        {
 //            var extruded = new IfcExtrudedAreaSolid
 //            {
 //                SweptArea = ifcProfileDef,
 //                Position =  placement3D,
 //                ExtrudedDirection = direction ,
 //                Depth = depth,
 //            };
 //            
 //            var shaperep = new IfcShapeRepresentation
 //            {
 //                ContextOfItems = representationContext,
 //                RepresentationIdentifier = "Body",
 //                RepresentationType = "SweptSolid",
 //                Items = new List<IfcRepresentationItem>(),
 //            };
 //            shaperep.Items.Add(extruded);
 //            
 //            var ifcShape = new IfcProductDefinitionShape
 //            {
 //                // Name=
 //                // Description =
 //                Representations = new List<IfcRepresentation>(),
 //            };
 //            ifcShape.Representations.Add(shaperep);
 //            
 //            return ifcShape;
 //        }
 //
 //
 public static BbExtrudedGeometry RetrieveFromMainPiece(BbElement mainPiece)
 {
     var ret = new BbExtrudedGeometry();
     var ipds = mainPiece.IfcObject as IfcElement;
     var iPDS = ipds.Representation as IfcProductDefinitionShape;
     var reps = iPDS.Representations;
     foreach (var rep in reps)
     {
         var iSR = rep as IfcShapeRepresentation;
         var repItems = rep.Items;
         foreach (var repItem in repItems)
         {
             var ExtGeo = repItem as IfcExtrudedAreaSolid;
             if (ExtGeo == null) continue;
             var semExGeo = new BbExtrudedGeometry { IfcGeometricRepresentationItem = ExtGeo, _ifcProductDefinitionShape = iPDS, _ifcShapeRepresentation = iSR };
             BbInstanceDB.AddToExport(semExGeo);
             //var profile = BbProfile.Retrieve(semExGeo);
             //mainPiece.Profile = profile;
             ret = semExGeo;
         }
     }
     return ret;
 }
        public static BbExtrudedGeometry Create(
			BbProfile profile,
			BbPosition3D position3D,
			BbDirection3D direction3D,
			double depth)
        {
            var extrudedGeometry = new BbExtrudedGeometry(profile,
                                         position3D,
                                         direction3D,
                                         depth);

            return extrudedGeometry;
        }
 /// <summary>
 /// wrong implmentation
 /// </summary>
 /// <param name="extrudedGeometry"></param>
 /// <returns></returns>
 public static BbSlottedHoleProfile Retrieve(BbExtrudedGeometry extrudedGeometry)
 {
     var ret = new BbSlottedHoleProfile();
     //var profileDef = extrudedGeometry._ifcExtrudedAreaSolid.SweptArea as IfcArbitraryClosedProfileDef;
     //var semHProfile = new BbSlottedHoleProfile { IfcProfileDef = profileDef };
     //BbInstanceDB.AddToExport(semHProfile);
     //ret = semHProfile;
     return ret;
 }
Exemple #19
0
        BbCutCope(
            BbElement hostElement,
            double copeWidth,
            double copeDepth,
            double copeRadius,
            SemCopeLocation copeLocation)
        {
            BbCopeProfile profile = BbCopeProfile.Create(copeWidth, copeDepth, copeRadius, copeLocation);

            var mainPart = hostElement as BbPiece;

            if (mainPart == null)
            {
                return;
            }

            BbPosition3D pos;

            switch (copeLocation)
            {
            case SemCopeLocation.BottomLeft:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(new double[] {
                    mainPart.Profile.Width / 2,
                    -mainPart.Profile.Depth / 2,
                    0
                }),
                    BbHeaderSetting.Setting3D.XAxisMinus,
                    BbHeaderSetting.Setting3D.ZAxis);
                break;

            case SemCopeLocation.BottomRight:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(new double[] {
                    mainPart.Profile.Width / 2,
                    -mainPart.Profile.Depth / 2,
                    mainPart.Length
                }),
                    BbHeaderSetting.Setting3D.XAxisMinus,
                    BbHeaderSetting.Setting3D.ZAxis);
                break;

            case SemCopeLocation.TopRight:
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(new double[] {
                    mainPart.Profile.Width / 2,
                    mainPart.Profile.Depth / 2,
                    mainPart.Length
                }),
                    BbHeaderSetting.Setting3D.XAxisMinus,
                    BbHeaderSetting.Setting3D.ZAxis);
                break;

            default:     // TopLeft
                pos = BbPosition3D.Create(
                    BbCoordinate3D.Create(new double[] {
                    mainPart.Profile.Width / 2,
                    mainPart.Profile.Depth / 2,
                    0
                }),
                    BbHeaderSetting.Setting3D.XAxisMinus,
                    BbHeaderSetting.Setting3D.ZAxis);
                break;
            }

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                hostElement.ObjectBbLocalPlacement, pos);

            BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create(
                profile,
                BbHeaderSetting.Setting3D.DefaultBbPosition3D,
                BbHeaderSetting.Setting3D.ZAxis,
                mainPart.Profile.Width);

            _ifcOpeningElement = new IfcOpeningElement
            {
                GlobalId     = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory = hostElement.IfcObject.OwnerHistory,
                // Name =
                // Description =
                ObjectType      = "Opening",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                Representation  = bbExtrudedGeometry.IfcProductDefinitionShape,
            };

            _ifcRelVoidsElement = new IfcRelVoidsElement
            {
                GlobalId                = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory            = hostElement.IfcObject.OwnerHistory,
                Name                    = "Cope",
                RelatingBuildingElement = hostElement.IfcObject as IfcElement,
                RelatedOpeningElement   = _ifcOpeningElement,
            };
        }
 public static BbExtrudedGeometry RetrieveFromFeature(BbFeature feature)
 {
     var ret = new BbExtrudedGeometry();
     // need modification
     //var pDS = feature.IfcOpeningElement.Representation as IfcProductDefinitionShape;
     //var representations = pDS.Representations;
     //foreach (var representation in representations)
     //{
     //    var sR = representation as IfcShapeRepresentation;
     //    var repItems = representation.Items;
     //    foreach (var repItem in repItems)
     //    {
     //        var eAS = repItem as IfcExtrudedAreaSolid;
     //        var semExtudedGeometry = new BbExtrudedGeometry { _ifcProductDefinitionShape = pDS, IfcGeometricRepresentationItem = eAS, _ifcShapeRepresentation = sR };
     //        ret = semExtudedGeometry;
     //    }
     //}
     return ret;
 }