How to create a loop in Dynamo

Hello everyone, I have multiple elements connect to each other. At the beginning, they have the same parameter value but when coordinating, the modelers may delete elements and draw new ones so they will not have value anymore. For that reason, I want to create a Dynamo script that can set value for the empty ones. My idea is find the elements that don’t have value but connect to the elements that have and set value from them. I did it already but I need to put it into a loop to solve for all cases. So is it possible to create a loop by using node in Dynamo? Because I don’t know any programming language. The image below will explain my idea (the green rectangles represent for elements that have value in a parameter and the red rectangles are the elements that don’t have value). Also, I’ve attached the dyn file, please take a look and advise if any. I’ll be appreciated.
Home.dyn (49.6 KB)


Hi @Luffy11 ,

You can use the MEPover package for that.
Try this:

Thank you for your advice. Yes, I know this node but didn’t use it because if this line connects to multiple line ducts which have different values, how can we know the empty ones belong to which line?

Maybe the connector node can help you?
When you retrieve the connectors you have always 2 connectors (in this case)

Than you can group the elements by the connector

1 Like

Oh yeah, that’s a good point. Thanks a lot for your help. I will try it.

1 Like