示例#1
0
        internal static Wall ToWall(this IfcWallStandardCase wall,
                                    IEnumerable <IfcOpeningElement> openings)
        {
            var transform = new Transform();

            transform.Concatenate(wall.ObjectPlacement.ToTransform());

            var os = openings.Select(o => o.ToOpening());

            // An extruded face solid.
            var solid = wall.RepresentationsOfType <IfcExtrudedAreaSolid>().FirstOrDefault();

            if (solid == null)
            {
                // It's possible that the rep is a boolean.
                var boolean = wall.RepresentationsOfType <IfcBooleanClippingResult>().FirstOrDefault();
                if (boolean != null)
                {
                    solid = boolean.FirstOperand.Choice as IfcExtrudedAreaSolid;
                    if (solid == null)
                    {
                        solid = boolean.SecondOperand.Choice as IfcExtrudedAreaSolid;
                    }
                }

                // if(solid == null)
                // {
                //     throw new Exception("No usable solid was found when converting an IfcWallStandardCase to a Wall.");
                // }
            }

            // A centerline wall with material layers.
            // var axis = (Polyline)wall.RepresentationsOfType<IfcPolyline>().FirstOrDefault().ToICurve(false);

            foreach (var cis in wall.ContainedInStructure)
            {
                cis.RelatingStructure.ObjectPlacement.ToTransform().Concatenate(transform);
            }

            if (solid != null)
            {
                var c = solid.SweptArea.ToCurve();
                if (c is Polygon)
                {
                    transform.Concatenate(solid.Position.ToTransform());
                    var result = new Wall((Polygon)c,
                                          (IfcLengthMeasure)solid.Depth,
                                          null,
                                          transform,
                                          null,
                                          false,
                                          IfcGuid.FromIfcGUID(wall.GlobalId),
                                          wall.Name);
                    result.Openings.AddRange(os);
                    return(result);
                }
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// Convert an IfcWallStandardCase to a Wall.
        /// </summary>
        /// <param name="wall"></param>
        public static Wall ToWall(this IfcWallStandardCase wall)
        {
            var transform = new Transform();

            transform.Concatenate(wall.ObjectPlacement.ToTransform());
            var solid = wall.RepresentationsOfType <IfcExtrudedAreaSolid>().FirstOrDefault();

            foreach (var cis in wall.ContainedInStructure)
            {
                cis.RelatingStructure.ObjectPlacement.ToTransform().Concatenate(transform);
            }

            var material = new Material("wall", Colors.Green);

            if (solid != null)
            {
                var c = solid.SweptArea.ToICurve();
                if (c is Polygon)
                {
                    transform.Concatenate(solid.Position.ToTransform());
                    var result = new Wall(new Profile((Polygon)c), (IfcLengthMeasure)solid.Depth, material, transform);
                    result.Name = wall.Name;
                    return(result);
                }
            }
            return(null);
        }
示例#3
0
        /// <summary>
        /// Convert an IfcWallStandardCase to a Wall.
        /// </summary>
        /// <param name="wall">An IfcWallStandardCase.</param>
        /// <param name="openings">A collection of IfcOpeningElement belonging to this wall.</param>
        /// <param name="wallType">The wall's wall type.</param>
        private static Wall ToWall(this IfcWallStandardCase wall,
                                   IEnumerable <IfcOpeningElement> openings, WallType wallType)
        {
            var transform = new Transform();

            transform.Concatenate(wall.ObjectPlacement.ToTransform());

            // An extruded face solid.
            var solid = wall.RepresentationsOfType <IfcExtrudedAreaSolid>().FirstOrDefault();

            // A centerline wall with material layers.
            // var axis = (Polyline)wall.RepresentationsOfType<IfcPolyline>().FirstOrDefault().ToICurve(false);

            foreach (var cis in wall.ContainedInStructure)
            {
                cis.RelatingStructure.ObjectPlacement.ToTransform().Concatenate(transform);
            }

            // var os = openings.Select(o=>o.ToOpening()).ToArray();

            if (solid != null)
            {
                var c = solid.SweptArea.ToICurve();
                if (c is Polygon)
                {
                    transform.Concatenate(solid.Position.ToTransform());
                    var result = new Wall(new Profile((Polygon)c), wallType, (IfcLengthMeasure)solid.Depth, transform);

                    result.Name = wall.Name;
                    return(result);
                }
            }
            return(null);
        }