Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Tengo un sistema de tuberia,que contiene 19 tuberias,Desearia obtener los conectores,pero solo me da dos conectores,por que?
I have a pipe system, which contains 19 pipes, I would like to get the connectors, but it only gives me two connectors, why?
Aqui estas mi codigo
Here you are my code
public void Get_Connector_PipingSystem(Document doc)
{
List<MEPCurve> mEPCurves = new List<MEPCurve>();
List<Connector> connectors = new List<Connector>();
foreach (PipingSystem pipingSystem in new FilteredElementCollector(doc).OfClass(typeof(PipingSystem))
.WhereElementIsNotElementType())
{
if (pipingSystem.SystemType == PipeSystemType.DomesticColdWater)
{
if (pipingSystem.IsWellConnected == true)
{
ElementSet elementSet = pipingSystem.PipingNetwork;
//string datos = "";
//ConnectorSet connectors = null;
foreach (Element elem in elementSet)
{
//FamilyInstance fi = elem as FamilyInstance;
//if (fi == null)
//{
// continue;
//}
if (elem is MEPCurve)
{
//MEPCurve mepCurve = elem as MEPCurve;
mEPCurves.Add(elem as MEPCurve);//Add 19 pipes
foreach (MEPCurve mepCurve in mEPCurves)
{
connectors = GetConnectors(mepCurve);
}
}
}
//....
}
}
}
TaskDialog.Show("Info", connectors.Count.ToString());
}
//Input MEPCurve object, e.g. Pipe, Duct, CableTray, Wire
//Function returns list of connectors from MEPCurve object
private List<Connector> GetConnectors(MEPCurve mepCurve)
{
//1. Get connector set of MEPCurve
ConnectorSet connectorSet = mepCurve.ConnectorManager.Connectors;
//2. Initialise empty list of connectors
List<Connector> connectorList = new List<Connector>();
//3. Loop through connector set and add to list
foreach (Connector connector in connectorSet)
{
connectorList.Add(connector);
}
return connectorList;
}
Solved! Go to Solution.