and as per the replies to the second post - the simpler the definition you can send that exhibits the problem, the better.
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.
Thanks you very much for the time you spent, Andrew.
I think it will help - i imagined a solution such as this one. I’ll let you now …
Well i met the same problem using the decoupled scenario. After some tests, the HUI button was staying on True value systematically (even after manually having disabled and enabled it), until I delete the Create Button component and create a new one. Painfull…
Here is a clue :
In the VB component started with the Button, I have been replacing the following line, warning the end of the Word generation to the user :
(I did that because Rhino.UI.Dialogs.ShowMessageBox() has been been removed in Rhino 6 and i want a code compatible with both Rhino 5 and Rhino 6)
With the System.Windows.Forms.MessageBox.Show() call, the bug is systematic, not depending on that fact that the decoupled scenario is implemented or not.
Is there a way to detect the end of the slow/long running function, and then force the HUI button to False, without Grasshopper detecting a loop in the definition ?
I’m having the same issue and it’s very annoying. The button stay on true as well but only when I use the button to start a simulation.
Is there any update?
We have found a palliative which does the job : put a “Expire solution” component (Human plug-in) activated with the values Listener of the button.
that’s… not recommended. You should never expire a “create” component after the window has launched.
Still struggling with this problem.
Any idea how to fix it ?
I’m forced to open the hood of the definition and get my hands dirty by baking the old fashioned way
I’ve given you everything I’ve got on this one, sorry.
I’m facing the same issue even with the new update of Rhino/Grasshopper. If I have a button on the canvas instead of Human UI then the problem is fixed. But it’s not the best way. I wish we could do something about it.
The “decoupled” approach above - with a toggle rather than a button - has worked in every case I’ve ever encountered personally. Button on/off staying on
Beyond that you’ll have to do some custom scripting to trigger your simulation - such as launching it from a delayed “ScheduleSolution” call if possible.
Hi all – this is a problem I’ve run into many times, it often happens when using a button to trigger a Rhino command or other system event that opens a dialog.
Not sure if this will work with a long-running simulation but the solution I have used in the past is something I call a “Spoof Button Release” component, which essentially is a component that accepts a boolean input and when true, schedules a solution with about 100ms delay. You use this component directly after a True-Only button. Here’s a C# version of the custom component I use.
SpoofButtonRelease.gh (10.7 KB)
As mentioned in another thread, I’m using a keyboard triggered button and have since not had problems with a button.
Thread regarding Elefront baking problems:
And the keyboard shortcut:
yes i am using. Elefront Bake
So maybe try the button shortcut I mentioned. I think the only downside to Elefront bake all is that you will have to plug in the Grasshopper button to all bake components manually
I rebuilt the button nodes. it helped no problem …
I use the Elefront because it can bake and connect to a group.
In this post maybe a step for a solution, i try the code but the problem with expire solution
button.gh (4.9 KB)