How to kill hung Ruby script?
-
I've been using Fredo6 's RoundCorner plug-in.
It's an awesome tool - most of the time.Every once in a while it hangs SketchUp and the only way out seems to be to force quit SU.
Is there a way just to cancel/kill the script when it hangs?
(hitting esc has no effect)If not, are there particular known selected edge combinations that can cause RoundCorner to hang?
It's not just RC that I've had problems with... other plug-ins as well.
It's just that I use RC all the time, so I run into much more often.A way to kill the script process and returning control to SU proper would be seriously useful given the plug-in free-for-all.
Doug
-
OK - I'm feeling a bit foolish!
Just returned to my hung script, and right-clicked... et voila: an 'exit tool' command that kills the script.
It's part of RoundCorners command set apparently.So to rephrase the question, do all plug-ins have/require an 'exit tool' command?
Is it part of the Ruby API, or something plug-in writers have to add themselves? -
No, that feature is not part of the ruby API. It is something Fredo built in. While it is very nice and handy, I think it also probably slows down the script (a tiny bit) because the csript must constantly be checking if the user has canceled. It would be nice if Google built something into the API somehow.
Also, most scripts that appear to be "hung" are probably just working. On detailed processes, they can take hours to complete. So don't think that it is not working just because SU is frozen. Chances are it is just processing.
Chris
-
@chris fullmer said:
Also, most scripts that appear to be "hung" are probably just working. On detailed processes, they can take hours to complete. So don't think that it is not working just because SU is frozen. Chances are it is just processing.
Well, with RC particularly I have also experienced this already. Sometimes it does hang even with quite simple rounding (just a few edges) while it processes much more complex sets in a snap other times.
-
@chris fullmer said:
Also, most scripts that appear to be "hung" are probably just working. On detailed processes, they can take hours to complete. So don't think that it is not working just because SU is frozen. Chances are it is just processing.
Chris
Is there a way to know if it's hung or just processing?
My assumption has been if there are no 'working' bars showing or progressing in the status bar area, the script is probably hung.With RC, certain combinations seem to give it trouble: but as Gaieus says, not necessarily the obviously complex ones.
In any attempt that eventually resolves in RC, there is visual progress indication that the script is still 'working'.The hangs seem pretty obvious, though I suppose I could be misinterpreting a very long process for a hang, on occasion.
-
@db11 said:
Is there a way to know if it's hung or just processing?
Not exactly. But I wil say that I have never ecer never ever never seen a publicly released plugin hang. It is always processing. Plugins can cause bugsplats, they can force SU to close immediately. But I have never seen one hang. In the end, it always comes back to SketchUp and SketchUp attempts to deal with what the plugin did. I would guess the only way a plugin could truly completely stall would be if it entered an infinite loop (which is very possible and I have done to myself a quite a few times while writing plugins). But I have never seen a publicly released plugin do that.
So I would say that the plugin probably never hangs, but you might run out of patience before it can finish. Which happens. Sometimes it is not feasible to wait hours for something to process.
Chris
-
Chris, thanks for the explanation.
It is baffling in Round Corner how certain, seemingly complex, edge combinations process in seconds, (or at worst a minute or two), while other - apparently simpler - combinations don't resolve after 30 minutes or more. (it also crashes the program on occasion)
Obviously there is something going on I don't understand, so I don't yet get what the specific differences are in what I'm asking the plug-in to do. Maybe with more experience, it will become clear to me what it can and can't handle, and what can be done in a reasonable processing period (5 minutes or less - timed with a coffee break!), and what might take half the night.
What would be useful is a thermometer style progress indicator (with a remaining processing time countdown), so you can decide whether the time required is worth it for the desired effect. Plus it would negate the confusion of whether an apparently non-responsive program will every return control from the script.
Is there anything like that in the API toolkit, or would it have to be written by the plug-in author?
-
Todd Burch wrote a free progressbar script that is available to all developers to use. I use it in a few of my scripts. Unfortunately, once SketchUp stops updating the screen (which is when scripts appear to be "hung", that also freezes progressbar so it no longer shows the correct progress. So its a bit of a difficult thing to overcome. Fredo has done something for some of his scripts, and Didier Bur also did something with Component Spray which is nice. But in the end, it appears that it needs to be handled by Google.
Chris
Advertisement