Automatic iteration of an input value toggled by an action later on in the tree

Hi,

I have run into an issue with automation in my Grasshopper file. In short, the code below takes on a value from the slider furthest to the left in order to calculate the moment of inertia of different sections of a ship. This calculation is done in the green group. This data is then processed and input into a block of python code that takes this vector and automatically writes it to a text file, different files for different initial plate thicknesses.

The code works without any issues apart from having to manually adjust the slider for every iteration. For this reason I am looking for a method that knows that the block of python code has successfully written the file, and then automatically iterates the slider to the next value (within a certain limit).

I am open to any suggestions as I am not set on having this method in the final version.

Thank you in advance,

Jelle

Are you sure you need to wait until the file has been written? I mean, doesn’t that happen before the python code is finished (due file.write() is before the last line)?

You can change the slider using Metahopper. But do you really need to? Can’t you just create a simple counter and map these integers to the values you want the slider to have?

Well I am open to any suggestions, but I need a different output file for each thickness used as input. I am currently thinking of using a while loop to determine when the file has been written to que the next iteration of the plate thickness.