Przeglądaj źródła

Merge branch 'master' of https://git.dev.tencent.com/xuhuo1234/saga

xulisong 6 lat temu
rodzic
commit
8d02e27b48

+ 1 - 5
MBI/SAGA.MBI/DataArrange/DalEquipPart.cs

@@ -74,11 +74,7 @@ namespace SAGA.MBI.DataArrange
         /// <returns></returns>
         public static MEquipment GetPartParentElement(Element element)
         {
-            string code = element?.GetFamily().Name.Substring(0, 4); ;
-            if (code.IsNullOrEmpty()) return null;
-            //构件所关联的设备
-            var parentInst = element.Document.GetElements(new ElementIntersectsElementFilter(element))
-                .FirstOrDefault(t =>  !t.Id.IsEqual(element.Id) && t.GetFamilyCode() == code);
+            var parentInst = element.GetEquipPartParent();
             if (parentInst == null) return null;
             var equip = DalEquip.GetEquipment(parentInst);
             return equip;

+ 14 - 5
MBI/SAGA.MBI/Extend/ElementExtend.cs

@@ -209,11 +209,6 @@ namespace SAGA.MBI.Tools
                 //移除前面和后面的空格
                 code = code.Trim();
             }
-            else if (element is Wall wall)
-            {
-                if (wall.IsCurtaiWall())
-                    code = MBIConst.CurtainWallCode;
-            }
 
             return code;
         }
@@ -263,5 +258,19 @@ namespace SAGA.MBI.Tools
 
             return space;
         }
+        /// <summary>
+        /// 获取部件所关联的设备
+        /// </summary>
+        /// <param name="element"></param>
+        /// <returns></returns>
+        public static Element GetEquipPartParent(this Element element)
+        {
+            string code = element?.GetFamily().Name.Substring(0, 4); ;
+            if (code.IsNullOrEmpty()) return null;
+            //构件所关联的设备
+            var parentInst = element.Document.GetElements(new ElementIntersectsElementFilter(element))
+                .FirstOrDefault(t => !t.Id.IsEqual(element.Id) && t.GetFamilyCode() == code);
+            return parentInst;
+        }
     }
 }

+ 1 - 1
MBI/SAGA.Models/MBIItem/MBIBuiltInParameter.cs

@@ -83,7 +83,7 @@ namespace SAGA.Models
         /// <summary>
         /// 维修商
         /// </summary>
-        public readonly static string Maintainer = "	Maintainer";
+        public readonly static string Maintainer = "Maintainer";
         /// <summary>
         /// 保险商
         /// </summary>

+ 6 - 6
MBI/SAGA.RevitUtils/MEP/ConnectorExtend.cs

@@ -32,7 +32,7 @@ namespace SAGA.RevitUtils.MEP
                 reference.Add(element);
                 foreach (Connector connector in element.GetAllConnectors())
                 {
-                    if ((connector.ConnectorType != ConnectorType.Logical) && connector.IsConnected)
+                    if ((ConnectorType.Physical.HasFlag(connector.ConnectorType)) && connector.IsConnected)
                     {
                         foreach (Connector connector2 in connector.AllRefs.GetList())
                         {
@@ -62,7 +62,7 @@ namespace SAGA.RevitUtils.MEP
                 List<Connector> list = (baseConnector == null) ? element.Current.GetAllConnectors() : new List<Connector> { baseConnector };
                 foreach (Connector connector in list)
                 {
-                    if ((connector.ConnectorType != ConnectorType.Logical) && connector.IsConnected)
+                    if (ConnectorType.Physical.HasFlag(connector.ConnectorType) && connector.IsConnected)
                     {
                         foreach (Connector connector2 in connector.AllRefs.GetList())
                         {
@@ -97,7 +97,7 @@ namespace SAGA.RevitUtils.MEP
                 ConnectorSetIterator iterator = connectorSet.ForwardIterator();
                 while (iterator.MoveNext())
                 {
-                    if (((iterator.Current is Connector current) && (current.ConnectorType != ConnectorType.Logical)) && domain == current.Domain)
+                    if (((iterator.Current is Connector current) && (ConnectorType.Physical.HasFlag(current.ConnectorType))) && domain == current.Domain)
                     {
                         list.Add(current);
                     }
@@ -119,7 +119,7 @@ namespace SAGA.RevitUtils.MEP
                 ConnectorSetIterator iterator = connectorSet.ForwardIterator();
                 while (iterator.MoveNext())
                 {
-                    if (((iterator.Current is Connector current) && (current.ConnectorType != ConnectorType.Logical)))
+                    if (((iterator.Current is Connector current) && ConnectorType.Physical.HasFlag(current.ConnectorType)))
                     {
                         list.Add(current);
                     }
@@ -170,7 +170,7 @@ namespace SAGA.RevitUtils.MEP
                     while (iterator.MoveNext())
                     {
                         Connector current = iterator.Current as Connector;
-                        if ((current.ConnectorType != ConnectorType.Logical) || (current.ConnectorType == ConnectorType.Curve))
+                        if (current!=null&&ConnectorType.Physical.HasFlag(current.ConnectorType))
                         {
                             list.Add(current);
                         }
@@ -215,7 +215,7 @@ namespace SAGA.RevitUtils.MEP
         {
             List<Element> list = new List<Element>();
             Element owner = connector.Owner;
-            if ((connector.ConnectorType != ConnectorType.Logical) && connector.IsConnected)
+            if ((ConnectorType.Physical.HasFlag(connector.ConnectorType)) && connector.IsConnected)
             {
                 foreach (Connector connector2 in connector.AllRefs.GetList())
                 {