Loop a few sets of node

Hi, dynamo forum. I wish to loop a set of nodes say 10 of them through a counter. I have basic knowledge of python but do not know how to make a counter to loop 10 nodes in my code. Thankyou in advance.

1 Like

@dkpang98 Welcome to the forum!

Here’s a couple links about Python loops:
For Loop
Loop in Python

Here is a general example of using a While Loop:

count = 0
while count < 50:
    Print "Something"
    count = count + 1

Here is a general example of a For Loop:

for i in range(50):
    print "Something"

Hope this helps! Also, it can be helpful to post some of the code that you are currently working on.

2 Likes

@t.large Thanks.
I understand the basic. Just that I can’t figure out how to loop selected nodes to loop repetitively

Can you show us an example of what you’re trying to do? Dynamo is fairly good at looping what it needs to so you likely just need to supply it with the correct data to get it to loop internally.

Hi. Basically, I am reading a file from excel with 12 columns of sensor data sensor 1 to 12. What I plan is to read all of them and pick the max value from each of the sensors and update its respective beams after some analysis. I would like to loop from sensor 1 to 12 starting from the List.GetItemAtIndex.
Forgive my incomplete dynamo.

So with Dynamo you tend not to “loop” through entire iterations this way. As I mentioned previously, Dynamo is good at iterating through entire lists automatically. Rather than processing one input all the way through and then looping the next input, you would build your graph to handle all inputs at once.

1 Like

Will try it out using the entire lists. Thanks for the suggestion.