I noticed that there is no real way to deal with errors with the grasshopper player. It would be great to have a way to abort a transaction if something goes wrong. Right now if I set the grasshopper player to delete input and something goes wrong, ie the script doesn’t execute as expected, outputs a null etc the object still gets deleted. Is there a way to handle errors in the grasshopper player?
Hi -
I suppose that, in your Grasshopper definition, you can check the output up against what you think is expected, and, if not, output something else.
-wim
But then you output garbage and it deletes the original curve. The goal here is to not delete the input unless the expected behavior occurs, for example if you want to move a curve but you fail to collect a vector to move, you don’t want the original curve to just disappear without the moved one present.
You could use Stream Filter prior to your GH player output. If your script output goes null, check with Null Item component, hook that into the Stream Filter G input.
Connect your original curve to the 0 input and your script output into the 1 input.
Then pass the results of that Stream Filter node into your final GH player output.
Essentially, if your script returns null, pass the original curve along as the output instead.
Does that make sense?
That does, thanks for the tip!
Cool, you’re welcome