示例#1
0
        /// <summary>
        /// 通过IFC工具 获取Room的Curveloop属性
        /// 房间的CsurveLoop 可能有自交的情况(自交的情况下不能拉伸Solid),通过调整SpatialElementBoundaryLocation.Center可以消除
        /// </summary>
        /// <param name="room"></param>
        /// <returns>返回该房间边界的CurveLoop,包括墙、分隔线、柱等</returns>
        public static IList <CurveLoop> GetRoomBoundaryAsCurveLoopArray(this Room room)
        {
            var bndOpt = new SpatialElementBoundaryOptions();

            foreach (SpatialElementBoundaryLocation spl in Enum.GetValues(typeof(SpatialElementBoundaryLocation)))
            {
                //获取房间边界的定位点,可以是边界、中心、核心层中心、核心层边界等
                bndOpt.SpatialElementBoundaryLocation = spl;
                try
                {
                    var loops = ExporterIFCUtils.GetRoomBoundaryAsCurveLoopArray(room, bndOpt, true);

                    // 验证CurveLoop是否合法(因为有可能存在自交的情况)
                    GeometryCreationUtilities.CreateExtrusionGeometry(loops, XYZ.BasisZ, 10);

                    return(loops);
                }
                catch (Exception)
                {
                }
            }

            return(GetRoomBoundaryBySolid(room));
        }