I'm creating a user MEP calculation for plumbing fixture flow using a sample avaliable at https://thebuildingcoder.typepad.com/blog/2013/07/user-mep-calculation-sample.html
Is it possible to get the number of elements connected to the piping system from which the current pipe belongs to?
In other words, I want to use the number of elements connected as a variable to calculate the flow.
Solved! Go to Solution.
Solved by naveen.kumar.t. Go to Solution.
Hi @brunothiagorvs ,
Try using the below link
Traversing an MEP System and Retrieving Connected Elements
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Aplicación app = uiapp.Application;
Document doc = uidoc.Document;
string mep_seccion = "";
//Recorriendo el Sistema MEP
foreach (MEPSystem MEPSystem in new FilteredElementCollector(doc)
.OfClass(typeof(MEPSystem)))
{
List<MEPSection> seccionMeplista = new List<MEPSection>();
getSectionsFromSystem(MEPSystem, seccionMeplista);
foreach (MEPSection secc in seccionMeplista)
{
mep_seccion += secc.Number.ToString() + Environment.NewLine;
}
}
***************************************************************************************************
#region Obtener sección del sistema
/// <summary>
/// Obtener sección del sistema
/// </summary>
/// <param name="system"></param>
/// <param name="sections"></param>
static public void getSectionsFromSystem(MEPSystem system, List<MEPSection> sections)
{
if (system == null || sections == null)
return;
int nSection = system.SectionsCount;
if (sections > 0)
{
for (int ii = 1; ii < nSection + 1; ++ii) //section number start from 1
{
MEPSection section = system.GetSectionByNumber(ii);
if (section == null)
continue;
sections.Add(section);
}
}
}
#endregion
Can't find what you're looking for? Ask the community or share your knowledge.