| | |
| | | using 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; |
| | | } |
| | | } |
| | | } |
| | | using Autodesk.Revit.DB;
|
| | | using Autodesk.Revit.DB.Plumbing;
|
| | | using HStation.RevitDev.RevitDataExport.Common;
|
| | | using System;
|
| | | using System.Linq;
|
| | |
|
| | | namespace HStation.RevitDev.RevitDataExport.Utility
|
| | | {
|
| | | public static class FamilyInstanceExtense
|
| | | {
|
| | | public static bool IsPipeHat(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 == 1)
|
| | | {
|
| | | var iterator = connectors.GetEnumerator();
|
| | | iterator.MoveNext();
|
| | | Connector connector = iterator.Current as Connector;
|
| | | if (connector == null) { return false; }
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | 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 (GlobalResource.RevitModels.Contains(pipe.Id.IntegerValue.ToString()))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|