GhPython Bug/Question

Hello,

There seems to be weird problem when using Rhinoscriptsyntax.Command from inside a GhPython component in the latest Rhino 6 service release.

I am not 100% sure if its a problem from the code itself or from the component, attached is a simple example.

Pressing the Button, runs the script which basically draws a circle in rhino. After this happens, Grasshopper canvas freezes, everything else seem to be working/selectable (components menu, menu bar etc)

The only thing that seems to get it working properly again is pressing over the Button again, it is the only location clickable on the canvas, which runs the python component again and now everything is back to normal.

GhPython_Bug.gh (7.7 KB)

1 Like

Hi Sherif - I’m not seeing that here so far, but you might try this

rs.Command("_-Circle “+str(x) + " “+“50”+” _Enter”)

it seems a little cleaner.

-Pascal

Hi Pascal,
changed the code, but that changed nothing with the problem, attached is a short video showing what is happening.bug.rar (1.8 MB)

This bug has been around for a while (I first complained about it 5 years ago!) - there is some conflict where the Button component itself fails to release the mouse event whenever the script it triggers (can be python, c#, whatever) is interacting with the rhino document.

You will note some workarounds in the below forum posts:




1 Like

Just as a clarification, as @andheum mentions, this is a bug that happens in the interaction of any RhinoApp.RunScript() executions that targets the document and the Grasshopper button itself. I’ve just added a quick port to C# to demonstrate it.

button_bug.gh (13.0 KB)

Ach. I thought I fixed this a couple of weeks ago. Apparently not.

I reported this issue at RH-40528.

any way to fix??? ??? ??? ???
especially since now you can’t unload grasshopper. You have to close down the entire app

GH_ButtonPressProblem.gh (7.6 KB)
This example helped me fix it.

if(!run && !pending) //return when button isn’t pressed
return;
if(!pending) //return & set pending to true
{
pending = true;
return;
}
pending = false; // reset pending to false
RhinoApp.RunScript("_-Turntable Speed=30 Revolutions=1 Enter", false);