Using Rhino Input Custom Get methods stop Grasshopper

I’m experiencing a weird behavior of Grasshopper when using Rhinocommon custom inputs such GetLine or GetPoint.

I start the Get method with an external button, and it allows me to get the start and end point and add the line to a list as expected.

Once the Get method finishes, Grasshopper window sort of freeze, meaning it does not allow for any click apart from clicking on the external button that starts the script. The second time I click on it and draw the line it starts working normally again.

Any idea why?

draw lines.gh (3.0 KB)

Thanks for your help!

Ciao Michele!
Benvenuto!

This is a known “problem” with buttons.
Buttons actually recompute twice for each mouse click:
- when you press them (state goes from false to true)
- when you release them (state goes from true to false)

So, because your script interact with the UI and start working in the middle of press-release, you experience that problem.

A small workaround can be to make the script run only when the button is released (so when the state was true and become false)

See inside: draw lines _re.gh (8.7 KB)

Hi Riccardo,
Thank you for the reply! Works as expected now.
Great to know about this behaviour also. I will take it into consideration from now on.