Ending a tool
-
Hello there ruby scripters,
Im having difficulties in ending a selfmade tool.
I would like that the tool returns to the last selected tool after finishing a list of methods.
It is not really an option for me to rescript the tool to a method.Another problem for me is getting to start the list of methods only when 1 component instance (or 1 selection even) is selected, when no of multiple instances are selected it should prompt you to select one instance.
my code is something like this:if $selectie.single_object? == false
UI.beep
UI.messagebox("please select only 1 ")
Sketchup.active_model.selection.clear
else
method1
method2
endBut now if not 1 instance is selected it keeps hanging in the tool. How do i fix it to wait untill one thing is clicked and then execute the methods?
Kind regards,
Quintus -
Solved it with a Sketchup.send_action("selectSelectionTool:").
-
Excellent, glad you got it working. It sounded like you were looking for something much complicated than activating the selection tool.
Chris
-
@qverburg said:
Solved it with a Sketchup.send_action("selectSelectionTool:").
I end most of my complex tools with that....
-
-
@adamb said:
@tig said:
@qverburg said:
Solved it with a Sketchup.send_action("selectSelectionTool:").
I end most of my complex tools with that....
I've always used
Sketchup.active_model.tools.pop_tool
so it returns to whatever you had before rather than forcing the use of SelectionTool.Adam
But a lot of plugins end with you perhaps wanting to select something... or if I for example I have made a group you will want to move then I make it the model.selection and invoke the 'Move' tool...
-
@tig said:
@adamb said:
@tig said:
@qverburg said:
Solved it with a Sketchup.send_action("selectSelectionTool:").
I end most of my complex tools with that....
I've always used
Sketchup.active_model.tools.pop_tool
so it returns to whatever you had before rather than forcing the use of SelectionTool.Adam
But a lot of plugins end with you perhaps wanting to select something... or if I for example I have made a group you will want to move then I make it the model.selection and invoke the 'Move' tool...
Never ever ever second guess the user.
-
@chris fullmer said:
Excellent, glad you got it working. It sounded like you were looking for something much complicated than activating the selection tool.
Chris
Well at first I wanted it to be more complex indeed. But i found out that i could do what i wanted by ending the tool with that commando.
I had tried the pop tool but didnt get it working. But since you have to select something in order to use my tool selectSelectionTool gives the same result
Thanks for your thoughts though!regards,
Quintus -
@adamb said:
I've always used
Sketchup.active_model.tools.pop_tool
so it returns to whatever you had before rather than forcing the use of SelectionTool.
AdamDo yo have to use
Sketchup.active_model.tools.push_tool
to activate the tool then? Because I triedSketchup.active_model.tools.pop_tool
when I had activated the tool usingSketchup.active_model.tools.select_tool
- and that did not seem to do anything.
Advertisement