Пример #1
0
 public IfOpening(IfOpening opening) : base(opening.IfModel)
 {
     IfWall         = opening.IfWall;
     OpeningType    = opening.OpeningType;
     Direction      = opening.Direction;
     IfcOpening     = opening.IfcOpening;
     LocalPlacement = opening.LocalPlacement;
     IfLocation     = new IfLocation(opening.IfLocation);
     IfDimension    = new IfDimension(opening.IfDimension);
 }
Пример #2
0
 public IfDoor(IfDimension dimensions) : this(dimensions.XDim, dimensions.YDim, dimensions.ZDim, 0, 0, 0)
 {
 }
Пример #3
0
 public IfDoor(IfDimension dimensions, IfLocation l) : this(dimensions.XDim, dimensions.YDim, dimensions.ZDim, l.X, l.Y, l.Z)
 {
 }
Пример #4
0
        private void GetDimension()
        {
            //get the wall x,y,z
            var recD = IfcWall.Representation.Representations
                       .SelectMany(a => a.Items)
                       .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea)
                       .OfType <IIfcRectangleProfileDef>().FirstOrDefault() ??
                       IfcWall.Representation.Representations
                       .SelectMany(a => a.Items)
                       .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                       .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea)
                       .OfType <IIfcRectangleProfileDef>().FirstOrDefault() ??
                       IfcWall.Representation.Representations
                       .SelectMany(a => a.Items)
                       .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                       .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                       .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea)
                       .OfType <IIfcRectangleProfileDef>().FirstOrDefault() ??
                       IfcWall.Representation.Representations
                       .SelectMany(a => a.Items)
                       .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                       .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                       .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                       .OfType <IIfcExtrudedAreaSolid>().Select(a => a.SweptArea)
                       .OfType <IIfcRectangleProfileDef>().FirstOrDefault();



            var depth =
                IfcWall.Representation.Representations
                .SelectMany(a => a.Items)
                .OfType <IIfcExtrudedAreaSolid>().Select(a => a.Depth).FirstOrDefault();

            if (depth == 0)
            {
                depth =
                    IfcWall.Representation.Representations
                    .SelectMany(a => a.Items)
                    .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                    .OfType <IIfcExtrudedAreaSolid>().Select(a => a.Depth).FirstOrDefault();
            }
            if (depth == 0)
            {
                depth =
                    IfcWall.Representation.Representations
                    .SelectMany(a => a.Items)
                    .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                    .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                    .OfType <IIfcExtrudedAreaSolid>().Select(a => a.Depth).FirstOrDefault();
            }
            if (depth == 0)
            {
                depth =
                    IfcWall.Representation.Representations
                    .SelectMany(a => a.Items)
                    .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                    .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                    .OfType <IIfcBooleanClippingResult>().Select(a => a.FirstOperand)
                    .OfType <IIfcExtrudedAreaSolid>().Select(a => a.Depth).FirstOrDefault();
            }


            if (depth == 0)
            {
                try
                {
                    depth = ((IIfcExtrudedAreaSolid)IfcWall.Representation.Representations
                             .SelectMany(a => a.Items)
                             .OfType <IIfcBooleanClippingResult>().
                             Select(a => a.FirstOperand).FirstOrDefault()).Depth;
                }
                catch (System.Exception)
                {
                }
            }



            //var recD = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcExtrudedAreaSolid>().Select(a => a.SweptArea).OfType<IIfcRectangleProfileDef>().FirstOrDefault();
            //var recD1 = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcBooleanClippingResult>().Select(a => a.FirstOperand).OfType<IIfcExtrudedAreaSolid>().Select(a => a.SweptArea).OfType<IIfcRectangleProfileDef>().FirstOrDefault();
            //var otherDepth = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcBooleanClippingResult>().Select(a => a.FirstOperand).OfType<IIfcExtrudedAreaSolid>().Select(a => a.Depth);
            //var depth = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcExtrudedAreaSolid>().Select(a => a.Depth);
            //get the wall thickness
            var thickness = IfcWall.HasAssociations.OfType <IIfcRelAssociatesMaterial>().OfType <IIfcMaterialLayerSetUsage>().Select(a => a.OffsetFromReferenceLine);//.OfType<IfcPositiveLengthMeasure>();
            var location  = ((IIfcAxis2Placement3D)((IIfcLocalPlacement)IfcWall.ObjectPlacement).RelativePlacement).Location;

            //using the Wall Class;
            if (recD != null && depth != null)
            {
                IfDimension = new IfDimension(Length.FromFeet(recD.XDim).Inches, Length.FromFeet(recD.YDim).Inches, Length.FromFeet(depth).Inches);
            }
        }
Пример #5
0
        private void GetDimension()
        {
            //get the wall x,y,z

            double shortDimension = Math.Sqrt(GetLengthSquare(PolyLine.Points[0], PolyLine.Points[1]));

            //
            ShortDirection = new IfDirection(PolyLine.Points[0], PolyLine.Points[1]);

            double LongDimension = 0;

            int noOfPoints = PolyLine.Points.ToArray().Length;

            double GetLengthSquare(IIfcCartesianPoint P1, IIfcCartesianPoint P2)
            {
                if (!double.IsNaN(P1.Z) && !double.IsNaN(P2.Z))
                {
                    return(Math.Pow(P1.X - P2.X, 2) + Math.Pow(P1.Y - P2.Y, 2) + Math.Pow(P1.Z - P2.Z, 2));
                }
                else
                {
                    return(Math.Pow(P1.X - P2.X, 2) + Math.Pow(P1.Y - P2.Y, 2));
                }
            }

            for (int i = 0; i < noOfPoints - 1; i++)
            {
                double L = Math.Sqrt(GetLengthSquare(PolyLine.Points[i], PolyLine.Points[i + 1]));
                if (shortDimension > L)
                {
                    shortDimension = L;
                    ShortDirection = new IfDirection((PolyLine.Points[i]), (PolyLine.Points[i + 1]));
                }
                LongDimension = Math.Max(LongDimension, L);
            }

            var depth =
                IfcSlab.Representation.Representations
                .SelectMany(a => a.Items)
                .OfType <IIfcExtrudedAreaSolid>().Select(a => a.Depth).FirstOrDefault();


            if (depth == 0)
            {
                try
                {
                    depth = ((IIfcExtrudedAreaSolid)IfcSlab.Representation.Representations
                             .SelectMany(a => a.Items)
                             .OfType <IIfcBooleanClippingResult>().
                             Select(a => a.FirstOperand).FirstOrDefault()).Depth;
                }
                catch (System.Exception)
                {
                }
            }
            var sDir = new Vector3D
                       (
                ShortDirection.X,
                ShortDirection.Y,
                ShortDirection.Z
                       );
            var zDir = new Vector3D(0, 0, 1);
            var vec  = zDir.CrossProduct(sDir);

            LongDirection = new IfDirection(vec.X, vec.Y, vec.Z);

            IfDimension = new IfDimension(Length.FromFeet(shortDimension), Length.FromFeet(LongDimension), Length.FromFeet(depth));



            //var recD = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcExtrudedAreaSolid>().Select(a => a.SweptArea).OfType<IIfcRectangleProfileDef>().FirstOrDefault();
            //var recD1 = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcBooleanClippingResult>().Select(a => a.FirstOperand).OfType<IIfcExtrudedAreaSolid>().Select(a => a.SweptArea).OfType<IIfcRectangleProfileDef>().FirstOrDefault();
            //var otherDepth = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcBooleanClippingResult>().Select(a => a.FirstOperand).OfType<IIfcExtrudedAreaSolid>().Select(a => a.Depth);
            //var depth = wall.Representation.Representations.SelectMany(a => a.Items).OfType<IIfcExtrudedAreaSolid>().Select(a => a.Depth);
            //get the wall thickness
            //var thickness = IfcSlab.HasAssociations.OfType<IIfcRelAssociatesMaterial>().OfType<IIfcMaterialLayerSetUsage>().Select(a => a.OffsetFromReferenceLine);//.OfType<IfcPositiveLengthMeasure>();
            //var location = ((IIfcAxis2Placement3D)((IIfcLocalPlacement)IfcSlab.ObjectPlacement).RelativePlacement).Location;
            //using the Wall Class;
        }