Can't make a loop

There is a list “A” of geometric elements and one key element “B”. You extract an element from the list which is itersects with “B” (by BoundingBox.Intersects). How can you make a loop that with every turn extracts an element from the list “A” intersecting to the previously found?

As a result, you need to get a list of all elements intersecting with each other starting from the first key element “B”.

Please see the example below:

In this example I have a simple ventilation system in Revit 2016, and I’m trying to make a pressure losses count script. It is necessary to choose all the elements that are connected to each other, starting from a diffusor.

Unfortunately, I can’t attach Revit and Dynamo initial files as a new member of a forum, but if anybody wants to take a look, I can send it by email.

Still can’t find a solution.

They say I can make a cycle by using a Python script. But I’m shure there must be another solution without scripting.

It’s not very clear what you are after. Are you trying to make a group of all elements that are connected?

See this topic, in the end he gives an example with some furniture, looks like he got it working:

Hi Einar,
Exactly, I’m trying to make a group of elements that are connected. Thank you!

But is there really no way to do this with basic Dynamo nodes?

I made one more try, please see the pictures below:
pic1: founded the first connected element (as before);
pic2: Some actions are added:
1 - is a loop fuction in DS code block, which puts an element founded earlier to a starting position while 3 is false;
2 - the same to the list of rested elements;
3 - condition for the loop 1;
4 - condition for the loop 2;
5 - marking founded elements with additional numerical parameter changing from “0” to “1”;
6 - potentually, this must form a list of all marked elements, i.e. the final result

And it is still not working. Could you be so kind as to tell me where I am wrong?


Hello Zak!

I’ve never seen anybody make a loop like that. I don’t know if it will work or not…

Does any of your elements have location curves? I’m more a structural guy so made this test with beams, it seems to achieve what you are after:

groupJoinedElements.dyn (9.0 KB)

That idea with curves looks interesting and close enough. Perhaps I should modify duct fittings and accessories to get their curves built. I’ll try. Thank you!

P.S. here is what do I have:

Excuse me all, maybe I haven’t explained it enough clear, but this is what I want to achieve after:

I want to form a list of elements which are located between air diffusors and the opened end of a duct system. This requires additional filters in a dynamo construction to make a ‘chain’ turn a right way on crosses, but never mind (it isn’t a problem). Every element has its own Pressure Drop parameter. By summing this values of elements from a list you can get a Total Pressure Drop value, which is very important for HVAC engineers. Why this way? Because of Revit’s basic researches are just awful and don’t work correctly.

So I suggested it’ll be a good idea to analyse connected elements by one, for example:
1 we have a diffusor
2 what it is connected with? *analysing => with a duct
3 OK, now we have a duct connected with that first diffusor. What this duct is connected with? … *analysing again => with an elbow.
4 …
5 a cross is connected with two new ducts. What to choose? *filtering and choosing the one with a larger air volume value => …
6 etc.

The catch is that you must analyse different objects time by time: diffusor at first, than a duct, than an elbow, etc. This is a sly problem which I haven’t solved yet.

ZK1_DYN_PressureLossCount-v2.1.0.dyn (25.2 KB)

ZK1_TST_PressureLossCount-v1.10(EXPORT).rvt (2.9 MB)