Trigger a reading of newline from csv in Grasshopper


Currently I have a Grasshopper file with imported csv file. After reading a single line from csv, a list of actions are performed, and at the very end, a set of files is baked and exported.
However, if I want the Grasshopper code to read the next line, I can only do that by moving a slider to change the counter. Changing state of the counter at the end, and passing that to the beginning of the code, is not allowed, since it is recursive.
Is there any other way to trigger the counter to move the next step? I would really wish to automatically generate and save files using several different sets of data, one-by-one.

Thanks in advance,

Hello Melissa,

recursion is allowed but not supported in native Grasshopper, you can however use Anemone, Hoopsnake or similar to do recursive calls. That’s still difficult to implement, because you don’t know when you are finished.
You may try the “index walker” script. Is that what you are looking for? (12.4 KB)

Hi TomTom,

Thank you for your reply. In the meantime, I used Anemone to increment the index value. I also used a time buffer. The reason for that is that I have bake&export in the script which takes perceivable time.

I really like your solution. It looks more elegant. I especially like that is easy to reset. I think it might be very useful when there is no so much “heavy lifting”. I tried to write something similar in python myself, but it was not running.

Best regards,