Cycle through options with grasshopper

I would like to cycle through design options using a grasshopper python component in the following way:

for i in range(1, 15):
    a = i

where a is the name of the output.
a would then be linked, for instance, to the diameter of a circle.

On the rhino viewport, I would expect to see the circle changing diameter at each step of the iteration.

Obviously what I show doesnt work.

I also tried using time.sleep(1) in between each steps, as well as ghenv.Component.ExpireSolution(True).

Both of them fail / crash the rhino software.

Any help or pointers hugely appreciated

In Grasshopper, components output after they finish computing so in your case the last iteration will always be output. All sleep is going to do is slow down the overall computation time until the last thing is output. What you are trying to do should be done outside of the solve instance or with a timer.

Check out my Python script from here:

It might be what you are looking for.

1 Like