Hi all,
I’m developing a tool that insert and rotate component only one specific point.
On pc, on Sketchup 2016, when I start the tool and press CRTL+N or CRTL+O or file/new or file/open Sketchup stop to asnwer. Everything is lock. When I’m clicking the ‘ding’ of the alert message is ringing but I can escape only by pressing escape.
The problem is not coming when i’m selecting another tool.
Is it a knowed problem ?
I can’t share all my script but just some part of it?
I forget to say that after file open the file dialogbox isn’t display.
On other tool, if you select file/open the tool is desactiveted and the dialogbox is open. (like on the move tool).
Previously, I have got the same problem but when launching a wbedialog or a UI I don’t remerber. ( the message box isn’t show and everything is lock with a ‘ding’. @john_drivenupthewall: I don’t try to open a file dialog with my tool. It’s just a case of use.
When tools are suspended, the SketchUp engine calls the suspend() callback method.
When SketchUp is done doing it’s interruption tasks, it will will re-activate the tool, and call it’s resume() callback method.
Any good tool should always define the 4 basic control callback methods: activate(), deactivate(), resume() and suspend().
Each SketchUp::Model instance has it’s own toolstack of Tool instance objects. When you load a new or different model, the current tool instance must be deactivated. In many cases this tool instance object may even get garbage collected, if it is no longer referenced by the toolstack. (Since the old toolstack itself was destroyed when the old model was unloaded.)
So you will see your tool’s deactivate() callback getting called, just prior to the current model getting unloaded, and the new model being loaded (from disk or a template.)
After the new model is ready, the default tool will be activated. And that tool is the SelectTool.
I did the testing with this:
class SomeTool
@@debug = true unless defined?(@@debug)
def activate(*args)
#
called( __method__, method(__method__).parameters() ) if @@debug
#
end
def deactivate(view)
#
called( __method__, method(__method__).parameters() ) if @@debug
#
end
def resume(view)
#
called( __method__, method(__method__).parameters() ) if @@debug
#
end
def suspend(view)
#
called( __method__, method(__method__).parameters() ) if @@debug
#
end
def called( methname, args )
#
if @@debug
puts "#{Module.nesting[0].name}.#{methname}() called."
args.each_with_index do |arg,i|
puts " arg #{i+1} is: #{arg.inspect}"
end
puts
end
#
end ###
end # tool class
No. I have always used Sketchup::Model#select_tool to activate a Ruby UI tool instance.
(The API documentation is misleading. It means Ruby Tool class instance. Not a native SketchUp tool.)
I have never used the push or pop methods of the Sketchup::Tools collection class. They were at one time fragile and caused bugsplats.
There is no (nice) way to inspect the items in the stack. The API writers have not mixed in the Enumerable module, and the collection does not even have a size() method.