For Loop on complicated operations

How could i create a “for loop” in dynamo ; The " for loop" has to loop through many complicated operations not just a math formulas .
Say i want to create a loop that implement some operations on every item of the list . how can i get that done ?

Not entirely sure you even need a for loop. That’s the beauty of dynamo! :slight_smile: It comes down to what kind of operations you want to perform, so if you have any more info for us it would be great.


Ok i will elaborate, lets make it clear with an example;
Say i create a code its function is to:
1- select a room in the ground floor plan
2- take its north boundary edge and make an offset to inside the room victor
3- then creates a wall aligned with that offset so the room gets smaller

we all know operation like this needs flatten many times and is somehow complicated, i can succeed with one room but when it comes to huge implementation on all the ground floor rooms, here is the problem , it turns into a mess .

i think a “for loop” could solve the problem , if so you only need to make a loop on all the ground floor rooms so that every room is operated alone to avoid the code crash .

its simple and basic in all programming languages like python for example :

for i in room_list :

but i couldn’t find an equivalent operation in Dynamo

I agree with @jostein_olsen. no loop required.
Five options:

  1. Make a custom node of your setup and feed in the list of rooms.
  2. Make a code block of your setup (yes one code block) and feed in the list of rooms.
  3. Make a function in a code block and call the function with a different code block and feed in the list of rooms.
  4. Flatten your list part way through as you mentioned (not a crazy set up).
  5. Do the exercise entirely in python.

Lacing and list management will matter on items 1-3, which I believe is the case in other coding languages (ie: python) as well. I think of a for loop as another fun means of lacing and list management but i’m not totally fluent so I may be wrong.

1 Like

Did you mean that if I make the hole operation in a custom node and forward all rooms to this custom node, it means that the rooms will loop on that operation?
Every room will be implemented individually??

If you build the custom node correctly, yes.

1 Like

Thank you :innocent:
I will try and get back to you.

unfortunately it didnt work i have tried to make it a custom node but the code crushes and didn’t loop on all the items

I thinks its about time to show some images/screen shots where you are stuck. We do not have any visibility on what you trying.


I agree. Cannot help you fix what we cannot see.

1 Like

2 posts were split to a new topic: For Loop View.Hide Elements

Iam trying to loop the whole dynamo graph, not a specific example, but i will try to make a dummy example elaborating the idea