From cd7d3ceff46090b1df76b96b788c2ffedb6f99f5 Mon Sep 17 00:00:00 2001 From: zhangyuekai <zhangyuekai@126.com> Date: 星期四, 08 八月 2024 12:03:24 +0800 Subject: [PATCH] 添加缺失文件 --- HStation.RevitDev/RevitDataExport/Utility/FamilyInstanceExtense.cs | 203 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 122 insertions(+), 81 deletions(-) diff --git a/HStation.RevitDev/RevitDataExport/Utility/FamilyInstanceExtense.cs b/HStation.RevitDev/RevitDataExport/Utility/FamilyInstanceExtense.cs index 1eb9dc5..61b9da6 100644 --- a/HStation.RevitDev/RevitDataExport/Utility/FamilyInstanceExtense.cs +++ b/HStation.RevitDev/RevitDataExport/Utility/FamilyInstanceExtense.cs @@ -1,81 +1,122 @@ -锘縰sing Autodesk.Revit.DB; -using Autodesk.Revit.DB.Plumbing; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HStation.RevitDev.RevitDataExport.Utility -{ - public static class FamilyInstanceExtense - { - public static bool IsWanTou(this FamilyInstance fi) - { - if (fi == null) return false; - - MEPModel mEPModel = fi.MEPModel; - var connectors = mEPModel.ConnectorManager.Connectors; - if (connectors == null) return false; - - if (connectors.Size != 2) - { - return false; - } - return true; - } - - public static bool IsSanTong(this FamilyInstance fi) - { - if (fi == null) return false; - - MEPModel mEPModel = fi.MEPModel; - var connectors = mEPModel.ConnectorManager.Connectors; - if (connectors == null) return false; - - if (connectors.Size != 3) - { - return false; - } - return true; - } - - public static bool IsSiTong(this FamilyInstance fi) - { - if (fi == null) return false; - - MEPModel mEPModel = fi.MEPModel; - var connectors = mEPModel.ConnectorManager.Connectors; - - if (connectors == null) return false; - if (connectors.Size != 4) return false; - return true; - } - - public static bool ConnectWithPumpSystem(this FamilyInstance fi) - { - if (fi == null) return false; - - MEPModel mEPModel = fi.MEPModel; - var connectors = mEPModel.ConnectorManager.Connectors; - if (connectors == null) return false; - - foreach (Connector connector in connectors) - { - var allRefs = connector.AllRefs; - foreach (Connector connectedElement in allRefs) - { - if (connectedElement.Owner is Pipe pipe) - { - if (Common.GlobalResource.ElementIds.Contains(pipe.Id.IntegerValue.ToString())) - { - return true; - } - } - } - } - - return true; - } - } -} +锘縰sing Autodesk.Revit.DB; +using Autodesk.Revit.DB.Plumbing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HStation.RevitDev.RevitDataExport.Utility +{ + public static class FamilyInstanceExtense + { + public static bool IsWanTou(this FamilyInstance fi) + { + if (fi == null) return false; + + MEPModel mEPModel = fi.MEPModel; + ConnectorSet connectors = mEPModel.ConnectorManager.Connectors; + if (connectors == null) return false; + + if (connectors.Size == 2) + { + var iterator = connectors.GetEnumerator(); + iterator.MoveNext(); + Connector connector1 = iterator.Current as Connector; + if (connector1 == null) { return false; } + double radius1 = connector1.Radius; + + iterator.MoveNext(); + Connector connector2 = iterator.Current as Connector; + if (connector2 == null) { return false; } + double radius2 = connector2.Radius; + if (Math.Abs(radius1 - radius2) < double.Epsilon) + { + return true; + } + } + return false; + } + + public static bool IsConverter(this FamilyInstance fi) + { + if (fi == null) return false; + + MEPModel mEPModel = fi.MEPModel; + ConnectorSet connectors = mEPModel.ConnectorManager.Connectors; + if (connectors == null) return false; + + if (connectors.Size == 2) + { + var iterator = connectors.GetEnumerator(); + iterator.MoveNext(); + Connector connector1 = iterator.Current as Connector; + if (connector1 == null) { return false; } + double radius1 = connector1.Radius; + + iterator.MoveNext(); + Connector connector2 = iterator.Current as Connector; + if (connector2 == null) { return false; } + double radius2 = connector2.Radius; + if (Math.Abs(radius1 - radius2) > double.Epsilon) + { + return true; + } + } + return false; + } + + public static bool IsSanTong(this FamilyInstance fi) + { + if (fi == null) return false; + + MEPModel mEPModel = fi.MEPModel; + var connectors = mEPModel.ConnectorManager.Connectors; + if (connectors == null) return false; + + if (connectors.Size != 3) + { + return false; + } + return true; + } + + public static bool IsSiTong(this FamilyInstance fi) + { + if (fi == null) return false; + + MEPModel mEPModel = fi.MEPModel; + var connectors = mEPModel.ConnectorManager.Connectors; + + if (connectors == null) return false; + if (connectors.Size != 4) return false; + return true; + } + + public static bool ConnectWithPumpSystem(this FamilyInstance fi) + { + if (fi == null) return false; + + MEPModel mEPModel = fi.MEPModel; + var connectors = mEPModel.ConnectorManager.Connectors; + if (connectors == null) return false; + + foreach (Connector connector in connectors) + { + var allRefs = connector.AllRefs; + foreach (Connector connectedElement in allRefs) + { + if (connectedElement.Owner is Pipe pipe) + { + if (Common.GlobalResource.ElementIds.Contains(pipe.Id.IntegerValue.ToString())) + { + return true; + } + } + } + } + + return false; + } + } +} -- Gitblit v1.9.3