Browse Source

mxg:修改导出元空间的默认值

mengxiangge 5 years ago
parent
commit
cf690e6781

+ 1 - 0
Executer/DataExport/RevitToJBim/ComponentParse/ParseSpace.cs

@@ -48,6 +48,7 @@ namespace RevitToJBim.ComponentParse
             //}
             JSpace bimObject = new JSpace();
             ParseCore.AttachObject(bimObject, wrapper);
+            bimObject.Name = space.GetSpaceDefaultName();
             var location = space.Location.GetPoint();
             if (location != null)
             {

+ 18 - 0
Executer/DataExport/RevitToJBim/Extension/SpaceExtend.cs

@@ -4,9 +4,11 @@
  * 创建日期:2019/12/6 14:52:05
  * ==============================================================================*/
 
+using Autodesk.Revit.DB;
 using Autodesk.Revit.DB.Mechanical;
 using RevitToJBim.MBI;
 using SAGA.DotNetUtils.Extend;
+using SAGA.RevitUtils.Extends;
 
 namespace RevitToJBim.Extension
 {
@@ -29,5 +31,21 @@ namespace RevitToJBim.Extension
             //空间比较特殊,周长为零就相当于删除
             return (perimeter.IsZero(MBIConst.SpacePerimeterTolerance)) || (area.IsZero(MBIConst.SpaceAreaTolerance));
         }
+
+        /// <summary>
+        /// 获取空间的默认名称
+        /// 如果空间名称为“空间”或者为“”则显示Name
+        /// 否则显示Room_Name
+        /// </summary>
+        /// <param name="space"></param>
+        /// <returns></returns>
+        public static string GetSpaceDefaultName(this Space space)
+        {
+            string defaultName = space.Name;
+            var roomname = space.GetParameterString(BuiltInParameter.ROOM_NAME);
+            if (roomname == "空间" || roomname.IsNullOrEmptyExt()) return defaultName;
+            defaultName = roomname;
+            return defaultName;
+        }
     }
 }