Browse Source

xls:修改管道,connector关联系统类型名称

xulisong 5 years ago
parent
commit
4dce341f58

+ 8 - 4
JBIM/JBIM/Component/Connector.cs

@@ -48,9 +48,13 @@ namespace JBIM.Component
         /// Connector连接的connectorId
         /// </summary>
         public List<BimId> ConnectedIds { get;private set; }
-        /// <summary>
-        /// connector关联的系统实例
-        /// </summary>
-        public BimId MepSystem { get; set; }
+        ///// <summary>
+        ///// connector关联的系统实例
+        ///// </summary>
+        //public BimId MepSystem { get; set; }
+        ///// <summary>
+        ///// 关联系统类型名称
+        ///// </summary>
+        public string MepSystemTypeName { get; set; }
     }
 }

+ 8 - 4
JBIM/JBIM/Component/Duct.cs

@@ -24,10 +24,14 @@ namespace JBIM.Component
         {
             ConnectedIds = new List<BimId>();
         }
-        /// <summary>
-        /// connector关联的系统实例
-        /// </summary>
-        public BimId MepSystem { get; set; }
+        ///// <summary>
+        ///// connector关联的系统实例
+        ///// </summary>
+        //public BimId MepSystem { get; set; }
+        ///// <summary>
+        ///// 关联系统类型名称
+        ///// </summary>
+        public string MepSystemTypeName { get; set; }
         /// <summary>
         /// Connector连接的connectorIds
         /// </summary>

+ 8 - 4
JBIM/JBIM/Component/Pipe.cs

@@ -25,10 +25,14 @@ namespace JBIM.Component
         /// Connector连接的connectorIds
         /// </summary>
         public List<BimId> ConnectedIds { get; private set; }
-        /// <summary>
-        /// connector关联的系统实例
-        /// </summary>
-        public BimId MepSystem { get; set; }
+        ///// <summary>
+        ///// connector关联的系统实例
+        ///// </summary>
+        //public BimId MepSystem { get; set; }
+        ///// <summary>
+        ///// 关联系统类型名称
+        ///// </summary>
+        public string MepSystemTypeName { get; set; }
         /// <summary>
         /// 管道直径
         /// </summary>

+ 2 - 2
JBIM/JBIM/Definition/GeometryLocation.cs

@@ -18,7 +18,7 @@ namespace JBIM
     /// </summary>
     public enum LocationType
     {
-        Point,
+        Point=0,
         Line,
         Arc,
         Common
@@ -35,7 +35,7 @@ namespace JBIM
 
         public static GeometryLocation CreatePointLocation(XYZ xyz)
         {
-            var result = new GeometryLocation(LocationType.Line);
+            var result = new GeometryLocation(LocationType.Point);
             result.Points.Add(xyz);
             return result;
         }

+ 18 - 16
JBIM/RevitToJBim/ComponentParse/ParseConnector.cs

@@ -57,12 +57,11 @@ namespace RevitToJBim.ComponentParse
             #region 所属系统解析
             //维护关联并递归
             var connectorId = jConnector.SourceId;
-            var systemId = connector.MEPSystem?.Id?.ToString();
-            if (!string.IsNullOrWhiteSpace(systemId))
+            var mepSystemTypeId = connector.MEPSystem?.GetTypeId();
+            if (mepSystemTypeId != null)
             {
-                ElementOneToOneRel rel = new ElementOneToOneRel(connectorId, systemId);
-                rel.SetElementType(TypeDefinition.Property_MepSystem);
-                context.RelationShips.Add(rel);
+                var systemTypeName = owner.Document.GetElement(mepSystemTypeId);
+                jConnector.MepSystemTypeName = systemTypeName.Name;
             }
            
             #endregion
@@ -86,18 +85,21 @@ namespace RevitToJBim.ComponentParse
 
         public override List<ElementWrapper> ArrangeRefElements(ElementWrapper wrapper, JBimParseContext context)
         {
-            if (!(wrapper.RefObject is Connector connector))
-            {
-                return null;
-            }
+            #region MyRegion
+            //if (!(wrapper.RefObject is Connector connector))
+            //{
+            //    return null;
+            //}
 
-            if (connector.MEPSystem == null)
-            {
-                return null;
-            }
-            //创建MepSystem
-            var mepSystemElementWrapper = new ElementWrapper(connector.MEPSystem);
-            return new List<ElementWrapper>() { mepSystemElementWrapper };
+            //if (connector.MEPSystem == null)
+            //{
+            //    return null;
+            //}
+            ////创建MepSystem
+            //var mepSystemElementWrapper = new ElementWrapper(connector.MEPSystem);
+            //return new List<ElementWrapper>() { mepSystemElementWrapper }; 
+            #endregion
+            return null;
         }
     }
 }

+ 4 - 6
JBIM/RevitToJBim/ComponentParse/ParsePipe.cs

@@ -56,10 +56,8 @@ namespace RevitToJBim.ComponentParse
             #region 关联数据处理相关
             #region 系统关系
             var pipeId = pipe.Id.ToString();
-            var systemId = pipe.MEPSystem.Id.ToString();
-            ElementOneToOneRel rel = new ElementOneToOneRel(pipeId, systemId);
-            rel.SetElementType(TypeDefinition.Property_MepSystem);
-            context.RelationShips.Add(rel);
+            var systemTypeName=pipe.Document.GetElement(pipe.MEPSystem.GetTypeId());
+            jPipe.MepSystemTypeName = systemTypeName.Name;
             #endregion
             #region Connector连接关系
             var connectors = pipe.GetConnectors();
@@ -86,8 +84,8 @@ namespace RevitToJBim.ComponentParse
                 return null;
             }
             //创建MepSystem
-            var mepSystemElementWrapper = new ElementWrapper(pipe.MEPSystem);
-            var wrappers=new List<ElementWrapper>() { mepSystemElementWrapper};
+           // var mepSystemElementWrapper = new ElementWrapper(pipe.MEPSystem);
+            var wrappers=new List<ElementWrapper>() { };
             var connectors = pipe.GetConnectors();
             foreach (var connector in connectors)
             {

+ 2 - 2
JBIM/RevitToJBim/TestExport.cs

@@ -43,11 +43,11 @@ namespace RevitToJBim
         }
     }
     /// <summary>
-    /// 增加缺失元空间
+    /// 测试提取数据
     /// </summary>
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
-    public class AddSiSpaceCommand : IExternalCommand, IExternalCommandAvailability
+    public class PickDataCommand : IExternalCommand, IExternalCommandAvailability
     {
 
         public  Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)