Prechádzať zdrojové kódy

Merge branch 'master' of http://39.106.8.246:3003/revit/RevitExport

xulisong 5 rokov pred
rodič
commit
f669f7dffa

+ 24 - 0
JBIM/RevitToJBim/Common/RevitUtil.cs

@@ -13,6 +13,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Autodesk.Revit.DB.Mechanical;
 using RevitToJBim.Extension;
 using RevitToJBim.MBI;
 using SAGA.DotNetUtils;
@@ -92,6 +93,29 @@ namespace RevitToJBim.Common
         }
 
         /// <summary>
+        /// 获取设备设施的参数
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        public static List<Parameter> GetSpaceParameters(Space space)
+        {
+            List<string> parameterNames = new List<string>() { MBIBuiltInParameterName.SpaceName, MBIBuiltInParameterName.SpaceNumber };
+            List<Parameter> parameters = new List<Parameter>();
+            foreach (var parameterName in parameterNames)
+            {
+                var revitParameter = space.GetParameter(parameterName);
+                if (revitParameter != null)
+                {
+                    var parameter = new Parameter(ParameterUtil.FindParameterDefine(parameterName));
+                    parameter.Value = revitParameter.AsString();
+                    parameters.Add(parameter);
+                }
+            }
+
+            return parameters;
+        }
+
+        /// <summary>
         /// 获取部件所关联的设备
         /// </summary>
         /// <param name="element"></param>

+ 4 - 1
JBIM/RevitToJBim/ComponentParse/ParseSpace.cs

@@ -52,7 +52,10 @@ namespace RevitToJBim.ComponentParse
             {
                 bimObject.Location =
                     GeometryLocation.CreatePointLocation(BimConvert.ConvertToXYZ(location));
-            }        
+            }
+
+            //Parameters
+            bimObject.Parameters = RevitUtil.GetSpaceParameters(space);
             var segments = space.GetBoundarySegments(new SpatialElementBoundaryOptions());
             if (segments != null)
             {

+ 2 - 2
JBIM/RevitToJBim/Extension/ElementExtension.cs

@@ -110,11 +110,11 @@ namespace RevitToJBim.Extension
                 if (isspace)
                 {
                     //增加过滤效率,如果上一步正确菜继续往下执行。
-                    isspace = isspace && space.IsPhase1Space();
+                    isspace = space.IsPhase1Space();
                 }
                 if (isspace)
                 {
-                    isspace = isspace && space.IsViewLevel();
+                    isspace = space.IsViewLevel();
                 }
             }
 

+ 10 - 0
JBIM/RevitToJBim/MBI/MBIBuiltInParameterName.cs

@@ -19,5 +19,15 @@ namespace RevitToJBim.MBI
         /// 设备本地名称
         /// </summary>
         public readonly static string EquipLocalName = "设备本地名称";
+
+        /// <summary>
+        /// 空间名称
+        /// </summary>
+        public readonly static string SpaceName = "名称";
+
+        /// <summary>
+        /// 空间编号
+        /// </summary>
+        public readonly static string SpaceNumber = "编号";
     }
 }