Shut down automaticly
-
I have another question.
Remember the calc.rb can be open from the Plugins menu.
But if I close Sketchup the calculator does not automaticly close with.
Is this fiasible ( viable,contrivable or whatever )?Burkhard
-
@burkhard said:
I have another question.
Remember the calc.rb can be open from the Plugins menu.
But if I close Sketchup the calculator does not automaticly close with.
Is this fiasible ( viable,contrivable or whatever )?
BurkhardYou could make an observer for the model (v6 only). It would be made by the calc.rb script - if you open the calculator the observer is added to the model. It then watches for when the model closes... and removes itself and closes the calculator if it's open ?
I haven't got an idea how to do it, BUT it should be do-able...
-
I think, you're talking about this script:
http://www.crai.archi.fr/rubylibrarydepot/ruby/calc.rbI can't image observing the calculator from within Sketchup Ruby. The UI.openURL method seems to start a non-Ruby thread, so the call returns immediately to next step in Ruby script. Because of several problems using Ruby threads (green threads), I wouldn't use them (Sketchup freezes).
An idea would be using the WebDialogs and embed a Javascript calculator. The WebDialog windows are observerable, they can react on several events and in combination with a model observer you can hide the window when opening a new model. If you close Sketchup, the WebDialog windows also will be closed.
azuby
-
@burkhard said:
I have another question.
Remember the calc.rb can be open from the Plugins menu.
But if I close Sketchup the calculator does not automaticly close with.
Is this fiasible ( viable,contrivable or whatever )?Burkhard
On Windows, you can use AppObserver.onQuit to set up the observer, and WIN32API to find (by name) and close the calc.exe window.
See my Ruby Toolbar plugin for using WIN32API window functions. I learned it from SketchyPhysics creator Chris Phillips.
Advertisement