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 false;
|
}
|
}
|
}
|