algorithmic modeling for Rhino
Dear all,
2 questions (1 question and 1 observation really):
1. esc keypress not detected in ghPython:
I was trying to use the escape key to break a loop from within the ghpython component, following this tutorial https://discourse.mcneel.com/t/stopping-a-conditional-loop-with-the....
It seems to only work in rhino's editpythonscript and not in ghPython in the gh canvas. swapping ghdoc to rhino.activedoc doesn't seem to do anything either.
So is there an actual method that detects the ESC key to break a ghPython loop from within ghcanvas?
2. unintended (but nice) behaviour when sc.escape_test() is thrown into the loop:
When i throw sc.escape_test() into a loop in ghPython, rhino's viewport seems to update results per loop, while it just freezes without it and outputs a final result.
here's a nice GIF to illustrate the behavior:
no gh timers!
Regards,
Li Qun
Tags:
Hi Li Qun,
thanks for reporting this.
You can get the feedback that you request by using the Grasshopper SDK:
Grasshopper.Kernel.GH_Document.IsEscapeKeyDown()
See here an example. I also fixed this in Rhino WIP, so that this works more generally in Rhino using the scriptcontext function.
Thanks again for your valuable input,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
PS: The unintended (but nice) behavior is due to the SDK function EscapePressed(), that needs to keep the message pump alive so that it can see if there are ESC messages coming in from Windows.
works like a charm!
i was helpless against the second component until it ended and then saw the console saying my WIP is too old. XD
i've added a raise SystemExit to your v6 just in case someone else came along, tried it with v5 and freaked out haha..
Time to try this week's Rhino WIP :)
Yes. I think this has to do with Grasshopper 'noticing' the push of the ESC key, but only David R. can tell.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by