Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Number of elements connected to a piping system

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
brunothiagorvs
1154 Views, 2 Replies

Number of elements connected to a piping system

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.

2 REPLIES 2
Message 2 of 3

Hi @brunothiagorvs ,

Try using the below link

Traversing an MEP System and Retrieving Connected Elements


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

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.

Post to forums  

Forma Design Contest


Rail Community