Button on/off staying on

I have reviewed the file you sent, and reproduced the issue in question (this in itself was not easy!). I am fairly sure the problem is with either your script or with Grasshopper itself - there have been prior reports of scripting components in GH with slow/long running functions failing to return control of mouse events back to the canvas. I do not think this issue in general is something I can solve.
However, I can recommend a workaround. In my preliminary tests this approach below eliminates the problem you are experiencing - though I can’t guarantee it will always do so. Rather than using metahopper enable/disable on your script, I would recommend leaving the script enabled and using MetaHopper “Set object value” to decouple the button triggering the script from the value returning from HUI. This is easier to demonstrate than explain:

In my tests with this configuration, the button consistently returned to false and the script never double-solved.

In general, these “decoupled” scenarios using metahopper with Human UI make for more reliable and easier to maintain grasshopper definitions - it removes a wired connection from the output of the HUI into the “business logic” of the definition in favor of a “remote” or wireless connection. There are many examples of this in the “Decoupled Snippets” available on the HUI food4rhino page.

Hope this helps.

1 Like