Просмотр исходного кода

MBIBuiltInParameterName转配置文件

wangwei 4 лет назад
Родитель
Сommit
c56f96c193

+ 18 - 5
Executer/DataExport/RevitToJBim/Common/RevitUtil.cs

@@ -20,6 +20,7 @@ using SAGA.DotNetUtils;
 using Parameter = JBIM.Component.Parameter;
 using SAGA.RevitUtils;
 using SAGA.DotNetUtils.Extend;
+using System.Configuration;
 
 namespace RevitToJBim.Common
 {
@@ -100,13 +101,14 @@ namespace RevitToJBim.Common
             }
             if (hasEquipComponentCode)
             {
+                var equipComponentCode = ConfigurationManager.AppSettings["EquipComponentCode"];
                 var typeParameter = ele?.GetElementType()?.Parameters;
                 foreach (Autodesk.Revit.DB.Parameter p in typeParameter)
                 {
-                    if (MBIBuiltInParameterName.EquipComponentCode.Equals(p.Definition.Name))
+                    if (equipComponentCode.Equals(p.Definition.Name))
                     {
                         if (!p.HasValue || (p.AsString() == null && p.AsString().Length == 0)) continue;
-                        var parameter = new Parameter(ParameterUtil.FindParameterDefine(MBIBuiltInParameterName.EquipComponentCode));
+                        var parameter = new Parameter(ParameterUtil.FindParameterDefine(equipComponentCode));
                         parameter.Value = p.AsString();
                         parameters.Add(parameter);
                     }
@@ -122,7 +124,7 @@ namespace RevitToJBim.Common
         /// <returns></returns>
         public static List<Parameter> GetFacilityParameters(FamilyInstance fi)
         {
-            List<string> parameterNames = new List<string>() { MBIBuiltInParameterName.EquipLocalName, MBIBuiltInParameterName.EquipLocalID, MBIBuiltInParameterName.PropertyID };
+            List<string> parameterNames = ConfigurationManager.AppSettings["FacilityParameters"].Split(',').ToList();
             List<Parameter> parameters = GetParameters(fi, parameterNames, true);
             return parameters;
         }
@@ -133,18 +135,29 @@ namespace RevitToJBim.Common
         /// <returns></returns>
         public static List<Parameter> GetSpaceParameters(Element space)
         {
-            List<string> parameterNames = new List<string>() { MBIBuiltInParameterName.SpaceName, MBIBuiltInParameterName.SpaceNumber, MBIBuiltInParameterName.SpaceStandardTypeCode, MBIBuiltInParameterName.SpaceStandardType };
+            List<string> parameterNames = ConfigurationManager.AppSettings["SpaceParameters"].Split(',').ToList(); 
             List<Parameter> parameters = GetParameters(space, parameterNames, false);
             return parameters;
         }
         /// <summary>
+        /// 获取房间的参数
+        /// </summary>
+        /// <param name="room"></param>
+        /// <returns></returns>
+        public static List<Parameter> GetRoomParameters(Element room)
+        {
+            List<string> parameterNames = ConfigurationManager.AppSettings["RoomParameters"].Split(',').ToList();
+            List<Parameter> parameters = GetParameters(room, parameterNames, false);
+            return parameters;
+        }
+        /// <summary>
         /// 获取设备设施的参数
         /// </summary>
         /// <param name="space"></param>
         /// <returns></returns>
         public static List<Parameter> GetMEPCurveParameters(MEPCurve curve)
         {
-            List<string> parameterNames = new List<string>() { MBIBuiltInParameterName.MEPCurveComments };
+            List<string> parameterNames = ConfigurationManager.AppSettings["MEPCurveParameters"].Split(',').ToList();
             List<Parameter> parameters = GetParameters(curve, parameterNames, false);
             return parameters;
         }

+ 1 - 1
Executer/DataExport/RevitToJBim/ComponentParse/ParseRoom.cs

@@ -51,7 +51,7 @@ namespace RevitToJBim.ComponentParse
             bimObject.Height = room.GetParameterDouble(BuiltInParameter.ROOM_HEIGHT);
 
             //Parameters
-            bimObject.Parameters = RevitUtil.GetSpaceParameters(room);
+            bimObject.Parameters = RevitUtil.GetRoomParameters(room);
             var options = new SpatialElementBoundaryOptions();
             //options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish;
             var segments = room.GetBoundarySegments(options);

+ 5 - 0
Starter/Starter/App.config

@@ -15,5 +15,10 @@
 		<add key="UseablePhaseName" value="阶段1"/>
 		<add key="SagaSign" value="-wanda"/>
 		<add key="CheckItems" value="SagaCheck,UnitCheck,FamilyNameCheck,EquipPartLocationCheck,ColumnCheck,ElementRangeCheck,ConnectorCheck,SystemNameCheck,EquipInSpaceCheck,SystemReferEquipCheck,ParameterIntegrityCheck,PipeCheck,XYZOverlapCheck"/>
+		<add key="FacilityParameters" value="设备本地名称,设备本地编码,PropertyID"/>
+		<add key="SpaceParameters" value="名称,编号,2.空间标准类型编码,3.空间标准类型"/>
+		<add key="RoomParameters" value="名称,编号,2.空间标准类型编码,3.空间标准类型"/>
+		<add key="MEPCurveParameters" value="注释"/>
+		<add key="EquipComponentCode" value="构件分类编码"/>
 	</appSettings>
 </configuration>

+ 2 - 2
Starter/Starter/Program.cs

@@ -37,8 +37,8 @@ namespace ExportStart
 #if DEBUG
             if (string.IsNullOrWhiteSpace(command))
             {
-                //command = "DataExport";
-                command = "DataCheck";
+                command = "DataExport";
+                //command = "DataCheck";
                 //path = @"E:\导出测试\testSpace.rvt";
                 //path = @"E:\导出测试\系统图修改编码版\消防系统图模型第一版V1219.rvt";
                 //path = @"E:\导出测试\无锡系统图1225\热源系统图模型第一版V1225.rvt";