Get element IDs of selected duct path in order joined

My goal is to select a duct route, grab the element IDs using “IDs of Selection”, and copy the string to dynamo to get a list of elements in the order joined. The problem now is Revit sorts the element IDs in numerical order, so the joined order is lost. The plan is to eventually grab a few parameters from these elements and export to Excel. Is there a way to get element IDs of a duct path in order joined or selected? Thanks!

Hi @sgebremeskel
This is not straight forward, although it is possible. One way to do this by getting all the connectors. However ducts are Revit Duct Class, while bends are FamilyInstance Class.

Once you have the connectors associated with the elements you can get them in a sort of order using a breadth-first search using the id as a node and the connectors Origin (XYZ) as edges.

If you start with a ‘leaf’ node (one connector) such as a terminal you can crawl through the elements and get the order. You will also have to handle T junctions etc.

Maybe I’m over thinking it and there is already a node out there?

Look into “Elements in connected network” from the Mepover package.

3 Likes