Grasshopper

algorithmic modeling for Rhino

When I blunder into the wrong parameter for a command that then means it takes nearly forever, there is currently utterly no way to stop a Grasshopper Python script if I happen to have the code editing window at the front. With the editor window closed I can at least issue Rhino command key commands like command-W which temporarily stop the script, but so far leave me no way to stop it, since Disable Solver doesn't work. As soon as I escape out of the command-W in Rhino, the slow loop starts up again.

This is the very most basic usability issue imaginable and it means I also often lose my work for having to force Rhino to end as I'm rapid fire trying things out without saving each time since I'm stuck in the editor window where there is no save function.

Can I add a timer to each loop to check if each iteration is taking too long and then stop the whole script?

Why on Earth didn't the developer follow Steve Jobs' user interface guidelines and check for user input? The escape key nearly always just fails.When dealing with very complex technical issues, the deal killer is my inability to use Python productively, knowing loop command typos of False instead of True can just be quickly cancelled.

If the Python module merely invoked its own Windows process I could use Windows to cancel it. If Grasshopper only had a command hotkey to disable the solver, and it really worked.

Related:

http://www.grasshopper3d.com/forum/topics/acknowledging-abort-request

http://www.grasshopper3d.com/forum/topics/stop-or-pause-processing-on

http://www.grasshopper3d.com/forum/topics/wish-list-abort-operation

http://www.grasshopper3d.com/forum/topics/feature-suggestion-large-...

Views: 2153

Replies to This Discussion

It worked, just adding a timer to quit otherwise Rhino locking Python component loops:

import time # To add a timer to possibly bogged down loops.
import sys # To force stop scrip with sys.exit().

START_TIME = time.clock() # System time in seconds.
print START_TIME
for i in range(0,1000):
  print "Hello the system time is: ",time.clock()
  time.sleep(i)
  if time.clock() - START_TIME > 5: # Is each step taking more than this many seconds?
    sys.exit() # Abort script!

Which hangs up then suddenly outputs all at once this:

430.338277205
Hello the system time is:  430.360092603
Hello the system time is:  430.360608176
Hello the system time is:  431.360177502
Hello the system time is:  433.360204130
Runtime error (SystemExitException): SystemExit
Traceback:
  line 48, in script

Without this extra code, I simply must Windows Task Manager kill Rhino. This is just amateur hour behavior to have no access to an escape key for Python scripts in Grasshopper. Also frustrating when I'm about to lose some edits is that if I wait some long amount of time for the Test run via the script editor window to actually finish, when I close the editor the script runs again on its own.

I'm still unable to stop scripts that do something like save a file quickly via Rhino commands, which are stuck on stupid, since there's no time problem, just a berserk robot churning away. Again here the command-W etc. trick pauses Rhino/Grasshopper/Python but then not even deleting my script component or disabling the Grasshopper solver stop the damn thing. And if it's Grasshopper itself feeding a long list into my Python, my script doesn't know it's being invoked again and again.

Hey Nik,

did you try to

import scriptcontext

and write

scriptcontext.escape_test()

to your loops? You should be able to abort scripts anytime.

Best,

Dominik

Interesting. Thanks, Steve Jobs. I call you that since he insisted that applications were focused on always following a user behavior loop above all else.

A search for escape_test here has no forum results. Wish there was a manual for this stuff.

Hi Nik

Here is a case

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service