Right now I have a C# script in Grasshopper where I push a toggle, and a randomly-seeded object is generated, and saved to disk. I want to make many of these objects automatically, so I am looking to write a grasshopper C# plugin that re-triggers upon completion, preferably indefinitely until a switch is flipped, or at least until a specified number of iterations is reached.
How do I listen for the completion event? How do I select the specific component to re-trigger? Or how do I tell the entire page to refresh upon completion? Or if not listening for an event, can I set a timer to re-triggers every x seconds? I think there are new features in Rhino 7 that make the timer easier than Rhino 6?
@DavidRutten there is no halting condition for this trigger scheduler. I would like to make one myself. How can I create a counter in C# that will persist between executions? I envision two timers, so it will run once a second for 100 times once a day.
Hi David, could you please clarify how to set trigger to activate based on solution completion, is this option available through the trigger component itself, with native components, or with code? Thanks
Trigger will make its targets recompute only after the current solution is completed.
A component can’t recompute (expire) while its recipients are still being calculated, if that happens, grasshopper will give you an error.
So, even if you set a short delay like 10ms, the total interval between recomputations is still:
[your components computation time]+10ms.
See this:
Re-triggering (or expiring) a panel is easy and fast (but still it isn’t really 10ms, because the UI needs to update).
But, if something is dependant of that panel, like a Divide Distance component (which is sort of heavy), you can see how then also the panel is expiring slower.
Because Trigger can expire its targets only after them and their recipients completed their computation.