[Plugin] Recall last tool v1.2
-
Hi all!
This plugin can recall last tool used. Based on this request.
You can use native Sketchup Shortcut function to add a new shortcut. I use F2!
All suggestions are welcomed!![EDIT1] This plugin is not compatible with Mac. Sorry. See below if you want to know why. A SU bug for Mac users.
[EDIT2] v1.2 -> 09/04/2009 : Observer was not always activated before using tool. Thank you Simon Le Bon!
-
Thxs Matt works great with Key shortcuts
-
Matt,
Nice work. My suggestion would be to use class variables (@@Matt_Model_Toolid, @@Matt_Model_Toolid2) or instance variables (@Matt_Model_Toolid, @Matt_Model_Toolid2) rather than global variables. Note that class variables must be declared right after the class is declared:
class Matt_Observer < Sketchup;;ToolsObserver @@Matt_Model_Toolid = nil @@Matt_Model_Toolid2 = nil def onActiveToolChanged (tools_object, toolname, toolid) # ETC...
but instance variables can be delcared anywhere in the class methods.
-
Hi Rick!
Thank you for the comment, I've updated the code... -
Hey Matt - You are eternally my friend! Thanks for listening to my request. I'm sure it will be useful to many!
-
-
Astucieux!
-
Merci Pilou
-
matt,
here we go again. unless i do not know how to use your new script, it is not working on mac! sorry...
-
Hi Edson... I hope you do not know!! I'm cursed...
So : Draw a . Draw a . Press space bar for .
Go to Plugins/Recall last tool. Rectangle tool is now recalled.If it does not work, can you open your ruby console, and try again, please?
And, at last, can you call rectangle tool, and try to copy this code in the ruby console ?Sketchup.send_action(21022)
This code calls selection tool.
Thank you Edson. And sorry for the inconvenience. -
matt,
it did not work. i had done it that way before. below is the ruby console reading.
glad to help you. keep your requests coming.
-
I read a lot /users/mahfuz...
-
@matt666 said:
Hi Edson... I hope you do not know!! I'm cursed...
Sketchup.send_action(21022)
This code calls selection tool.
Thank you Edson. And sorry for the inconvenience.
On differenct OS's, even the same OS with different menus, that magic number will have changed.
What's wrong with Sketchup.send_action(selectSelectionTool:);
When the menu structure is updated, then the call will still work even tho the menu id has changed.
-
Bravo Matt !!
at the very beginning of my learning SketchUp, I was surprised not to have this feature at disposal. And then I was accustomed to always recall my tools. And Here comes your ruby. It is as if suddenly we had won a great lightness. (F2 is great)it already belongs to my toolbox. simon
-
Merci Simon !
@pecan said:
On different OS's, even the same OS with different menus, that magic number will have changed.
Hi pecan! Are you sure of that? I use only two different numbers in my code. The rest is a recall of the last number used.
But there's a biiig problem with Mac... On Mac, function "send_action" does not accept integers. Only strings!@edson said:
It did not work. i had done it that way before. below is the ruby console reading.
Thank you Edson!
Ouch. I will try to find a solution. Can you test this code below, please?Sketchup.send_action("21022")
-
it looks good!
-
Ok. But if you have rectangle tool called, when you copy and validate the code, is the selection tool activated?
-
i drew a rectangle, then pressed the space bar, then used the script from the menu. the result is in the picture.
-
Sorry Edson, and all mac users. But I can't do anything with this bug. Function 'send_action' doesn't accept integers (so tool IDs) on Mac.
-
Result from SU ruby console
(eval)
result = Sketchup.send_action "selectSelectionTool:"
trueI was in error suggesting it was a num.
Advertisement