SketchUcation Premium Membership

 

 

[Plugin] Recall last tool v1.2

Re: [Plugin] Recall last tool

Postby Edson » Thu Feb 26, 2009 12:23 pm

it looks good!
Please, register (free) to access all the attachments on the forums.
edson mahfuz, architect
http://www.mahfuz.arq.br

Anyone can get you more for more, but it takes genius to get you more for less.
User avatar
Edson
Global Moderator
 
Posts: 2663
Joined: Mon Oct 22, 2007 1:46 pm
Location: Porto Alegre, Brasil
Name: Edson Mahfuz
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool

Postby Matt666 » Thu Feb 26, 2009 12:39 pm

Ok. But if you have rectangle tool called, when you copy and validate the code, is the selection tool activated?
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool

Postby Edson » Thu Feb 26, 2009 12:58 pm

i drew a rectangle, then pressed the space bar, then used the script from the menu. the result is in the picture.
Please, register (free) to access all the attachments on the forums.
edson mahfuz, architect
http://www.mahfuz.arq.br

Anyone can get you more for more, but it takes genius to get you more for less.
User avatar
Edson
Global Moderator
 
Posts: 2663
Joined: Mon Oct 22, 2007 1:46 pm
Location: Porto Alegre, Brasil
Name: Edson Mahfuz
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool

Postby Matt666 » Thu Feb 26, 2009 1:58 pm

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.
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool

Postby pecan » Thu Feb 26, 2009 7:12 pm

Result from SU ruby console

(eval)
result = Sketchup.send_action "selectSelectionTool:"
true

I was in error suggesting it was a num.
pecan
 
Posts: 67
Joined: Fri Sep 26, 2008 10:28 pm

Re: [Plugin] Recall last tool

Postby pecan » Thu Feb 26, 2009 7:37 pm

Using the tool name should work:

Code: Select all
def onActiveToolChanged (tools_object, toolname, toolid)
        print tools_object, toolname, toolid
      @@Matt_Model_Toolid = @@Matt_Model_Toolid2 if @@Matt_Model_Toolid2
      #@@Matt_Model_Toolid2 = toolid if not([21022,10508].index toolid)
      @@Matt_Model_Toolid2 = "select#{toolname}:";
      puts "1: #{@@Matt_Model_Toolid} 2: #{@@Matt_Model_Toolid2}"
   end
pecan
 
Posts: 67
Joined: Fri Sep 26, 2008 10:28 pm

Re: [Plugin] Recall last tool

Postby pecan » Thu Feb 26, 2009 7:45 pm

pecan wrote:Using the tool name should work:

Code: Select all
def onActiveToolChanged (tools_object, toolname, toolid)
        print tools_object, toolname, toolid
      @@Matt_Model_Toolid = @@Matt_Model_Toolid2 if @@Matt_Model_Toolid2
      #@@Matt_Model_Toolid2 = toolid if not([21022,10508].index toolid)
      @@Matt_Model_Toolid2 = "select#{toolname}:";
      puts "1: #{@@Matt_Model_Toolid} 2: #{@@Matt_Model_Toolid2}"
   end


Well... almost.

"selectCameraOrbitTool:" doesnt work.
It's action name is simply OrbitTool.
So maybe a hash of returned tool names and the send_action name.

sendActionToolName = {"CameraOrbitTool", "OrbitTool", } etc.
Or maybe a hash of just the exceptions.

Its a shame SU has to be so inconsistent.
pecan
 
Posts: 67
Joined: Fri Sep 26, 2008 10:28 pm

Re: [Plugin] Recall last tool

Postby pecan » Thu Feb 26, 2009 8:25 pm

Here's a list of the send_actions and the actual tool name returned by the observer.
Code: Select all
howRubyPanel:
viewBack:
viewBottom:
viewFront:
viewIso:
viewLeft:
viewRight:
viewTop:
viewPerspective:
viewShowAxes:
viewShowHidden:
viewZoomExtents:
viewZoomToSelection:
viewUndo:
selectOrbitTool: (CameraOrbitTool)
    ok  selectPositionCameraTool:
selectDollyTool: (CameraDollyTool
selectTurnTool:
selectWalkTool: (CameraWalkTool)
selectZoomTool: (CameraZoomTool)
selectFieldOfViewTool: (CameraFOVTool) <=== inconsistency
selectZoomWindowTool: (CameraZoomWindowTool)
pageAdd:
pageDelete:
pageUpdate:
pageNext:
pagePrevious:
renderWireframe:
renderHiddenLine:
renderMonochrome:
renderShaded:
renderTextures:
    ok  selectArcTool:
selectAxisTool: (SketchCSTool)
    ok  selectCircleTool:
    ok selectEraseTool:
    ok  selectFreehandTool:
selectLineTool: (SketchTool)
    ok  selectMeasureTool:
    ok  selectMoveTool:
    ok  selectOffsetTool:
    ok  selectPaintTool:
selectPolygonTool: (PolyTool)
    ok  selectProtractorTool:
    ok  selectPushPullTool:
    ok  selectRectangleTool:
    ok  selectRotateTool:
    ok  selectScaleTool:
    ok  selectSectionPlaneTool:
    ok  selectTextTool:
    ok  selectDimensionTool:
    ok  selectExtrudeTool:
    ok  selectSelectionTool:
editUndo:
editRedo:
editHide:
editUnhide:
fixNonPlanarFaces:

axes is returning SketchCSTool
3d text is returning 3DTextTool
plugins return RubyTool
orbit return CameraOrbitTool
pan returns CameraDollyTool
zoom returns CameraZoomTool
field of view returns CameraFDVTool
zoom window returns CameraFOVTool
zoom extends return CameraZoomWindowTool
walk return CamerWalkTool
look returns CameraPanTool
line returns selectSketchTool


Except for "selectFieldOfViewTool: (CameraFOVTool)" you can remove "Camera" from the observer reported name and prefix "select".
Special cases are PolyTool, Line tool, and axis tool.

On second thought, a hash like {reportedObserverName, sendSelectName} might be the best bet.
pecan
 
Posts: 67
Joined: Fri Sep 26, 2008 10:28 pm

Re: [Plugin] Recall last tool

Postby pecan » Thu Feb 26, 2009 8:59 pm

The following seems to work, and you can add to the exceptions hash when you find 'em.

Hope this helps some...

Code: Select all
# Supports Organizer.rb
=begin
Copyright 2009, Matt
All Rights Reserved

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

License:   Free

Author:        Matthieu NOBLET
Organization:   Matt
Name:            Recall_lst_tool
Version:         1.0
SU Version:      6 and 7
Date:            17/02/2009
Description:      Recall last tool used
Usage:         If you want to have a shortcut, please try with native Sketchup shortcuts...
History:
   1.000   17/02/2009
         First version

   1.100   17/02/2009
         Global variables replaced by Class variables
=end

require 'sketchup.rb'

class Matt_Observer < Sketchup::ToolsObserver
    def initialize
        @ToolExceptionsHash = {
           # observerName    send_actionName
            "FOVTool",       "FieldOfViewTool",
            "SketchCSTool",  "AxisTool",
            "SketchTool",    "LineTool",
            "PolyTool",      "PolygonTool"
        }
    end
   @@Matt_Model_Toolid = nil
   @@Matt_Model_Toolid2 = nil
   def onActiveToolChanged (tools_object, toolname, toolid)
        print tools_object, " ", toolname, " ", toolid, "\n"
        tname = toolname;
      @@Matt_Model_Toolid = @@Matt_Model_Toolid2 if @@Matt_Model_Toolid2
      # remove "Camera" prefix reported by ToolObserver"
      @@Matt_Model_Toolid2 = (tname[0,6]="" if (tname[0,6] == "Camera"));
      tname = @ToolExceptionsHash.fetch(tname, tname);
      @@Matt_Model_Toolid2 = "select#{tname}:";
      puts "1: #{@@Matt_Model_Toolid} 2: #{@@Matt_Model_Toolid2}"
   end
   def self.recall_last
        puts "sending action #{@@Matt_Model_Toolid}" if @@Matt_Model_Toolid
      return Sketchup.send_action(@@Matt_Model_Toolid) if @@Matt_Model_Toolid
      return Sketchup.send_action("selectSelectionTool:")
   end
end

unless file_loaded?(__FILE__)
   file_loaded(__FILE__)
   Sketchup.active_model.tools.add_observer(Matt_Observer.new)
   $submenu ? (organizer = $submenu) : (organizer = UI.menu("Plugins"))
   organizer.add_item("Recall last tool"){ Matt_Observer.recall_last }
end

pecan
 
Posts: 67
Joined: Fri Sep 26, 2008 10:28 pm

Re: [Plugin] Recall last tool

Postby Matt666 » Fri Feb 27, 2009 6:00 pm

Hi pecan!
Sorry, I didn"t test your plugin, but I think it doesn't work with plugins. So Non native tools...
I will test it! Thank you for that Pecan!
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool

Postby Matt666 » Thu Apr 09, 2009 10:12 am

Hi Pecan! Your method does not work with ruby tools, as expected...
A new version has been posted in the first post. It fixes a bug found by Simon Le Bon. Thank you Simon!
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool v1.2

Postby simon le bon » Thu Apr 09, 2009 1:26 pm

Hi Matt,
Hip Hip! I've just installed your plug v 1.2 and it seems working very well (all tools are seemingly supported)! So cool!!
It's too young to see if it remain operative on duration, but i believe this is now fixed.

Many thanks for that tool dear Matt :thumb: :)

I take it!


simon.
User avatar
simon le bon
 
Posts: 1077
Joined: Sat Jan 26, 2008 10:22 am
Location: Chouy/ Picardie/ France
Name: Simon Bonnet

Re: [Plugin] Recall last tool

Postby Edson » Thu Apr 09, 2009 1:40 pm

Matt666 wrote: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.

would the last update make it usable in macs?
edson mahfuz, architect
http://www.mahfuz.arq.br

Anyone can get you more for more, but it takes genius to get you more for less.
User avatar
Edson
Global Moderator
 
Posts: 2663
Joined: Mon Oct 22, 2007 1:46 pm
Location: Porto Alegre, Brasil
Name: Edson Mahfuz
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool v1.2

Postby Matt666 » Thu Apr 09, 2009 5:19 pm

I take it!
:thumb:
would the last update make it usable in macs?
... Dear Edson... I'm so sorry! :( You (and all Mac users!)have some problems with many of my scripts... Included this one...
I can't be usable in mac. Mac has a bug with main function used in this script: Sketchup.send_action(ToolID). And I can't do anything.
Sorry again Edson... :oops:
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool v1.2

Postby Edson » Thu Apr 09, 2009 6:24 pm

matt,

no problem. several other plugins you created work without problems. let's hope this bug gets solved in the future.
edson mahfuz, architect
http://www.mahfuz.arq.br

Anyone can get you more for more, but it takes genius to get you more for less.
User avatar
Edson
Global Moderator
 
Posts: 2663
Joined: Mon Oct 22, 2007 1:46 pm
Location: Porto Alegre, Brasil
Name: Edson Mahfuz
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool v1.2

Postby plot-paris » Mon May 11, 2009 10:23 pm

great plugin, Matthieu. :thumb:

just a thought: does it make sense to have a similar tool go through several previously used tools when pressing the shortcut key repeatedly?
User avatar
plot-paris
 
Posts: 1559
Joined: Tue Apr 01, 2008 10:15 am
Location: London
Name: plot-paris
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool v1.2

Postby Matt666 » Tue May 12, 2009 1:14 pm

Hi plot_paris!

That's a good idea... I will give a try! I think we may go through 10 previously used tools, and may undo history (retrun to the last tool used) by activating selection tool.
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool v1.2

Postby Chris Fullmer » Tue May 12, 2009 9:49 pm

Hey, I was just thinking about a plugin that would cycle through tools on repeated pressing of a button.

So assign it to the spacebar. Hit the spacebar once and its select. Twice it move, 3 is rotate. But I quickly decided against the silly plugin when I started thinking about having to hit the spacebar 26 times to get to "place camera" or something :lol:

But in this context, I think it is quite a good idea,

Chris
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6758
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool v1.2

Postby plot-paris » Wed May 13, 2009 10:02 am

another idea, although probably not managable with ruby, is a much more graphical approach:

when you hold down the space bar, a ring with tool buttons appears around your cursor in a circular fashion. you can now left click any button to get the tool. or you can simply turn the scroll wheel to file through them, either clockwise or counterclockwise. by default the selection tool is highlighted - so if you just press the space bar once, you get the select tool.

you can easily customise this tool-circle by holding down the space bar and then dragging unwanted tools out of the circle and vice versa.

well, maybe Google comes up with soemthing similar in the next release :D
User avatar
plot-paris
 
Posts: 1559
Joined: Tue Apr 01, 2008 10:15 am
Location: London
Name: plot-paris
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Recall last tool v1.2

Postby juan974 » Fri Mar 19, 2010 8:11 am

Merci MATT ...
juan974 (Réunion island)
juan974
 
Posts: 54
Joined: Sun May 24, 2009 5:22 pm
Location: Réunion island (indian ocean)
Name: gilles

Re: [Plugin] Recall last tool v1.2

Postby bitsnbites » Thu Jun 23, 2011 9:03 pm

Thank you very much, Matt666.
That´s the Plugin i was lookin for.

thx a lot
bitsnbites
 
Posts: 1
Joined: Thu Jun 23, 2011 7:57 pm

Re: [Plugin] Recall last tool v1.2

Postby jim4366 » Fri Jun 24, 2011 12:44 pm

I'm glad to see this. Thanks.
I was wondering if it's possible to map this tool to the mouse right click button. But only in the case that nothing is selected. If something is selected then the context menu opens as normal.

Years ago, autocad used to be set up like this. Once you're used to it, you don't need to take your eyes off of what you were working on to pick up a tool icon or a keyboard shortcut. The tool is always at your fingertips, instantly there. Reduces eye fatigue at the end of the day. And reduces mouse "mileage" so to say.

possible maybe ?
jim4366
 
Posts: 52
Joined: Sat Jul 04, 2009 1:01 pm
Location: Kitchener, ON, Canada
Name: Jim
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Intermediate

Re: [Plugin] Recall last tool v1.2

Postby Matt666 » Fri Jun 24, 2011 1:02 pm

I will try to find a solution.
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool v1.2

Postby Matt666 » Fri Jun 24, 2011 1:51 pm

Sorry, I don't know how to create a personal observer for controlling mouse events...
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool v1.2

Postby Pherim » Sat Jun 25, 2011 10:46 am

Neat, I didn't know this yet. Great timesaver when switching to select tool to return to the previously used tool.
Pherim
 
Posts: 42
Joined: Sat Jun 12, 2010 8:40 am
Location: Germany

Re: [Plugin] Recall last tool v1.2

Postby jim4366 » Sat Jun 25, 2011 2:22 pm

Matt666 wrote:Sorry, I don't know how to create a personal observer for controlling mouse events...

Okay. Thanks for checking.
jim4366
 
Posts: 52
Joined: Sat Jul 04, 2009 1:01 pm
Location: Kitchener, ON, Canada
Name: Jim
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Intermediate

Re: [Plugin] Recall last tool v1.2

Postby mirale999 » Mon Sep 12, 2011 5:40 am

Merci Matt! Great plugin~
By the way, I come up with an idea, I think maybe it's useful! :berserk:

I use the shortcut“shift+Y” to recall the last tool. When I use this plugin, a situation like this will happen:
first I use the "Edge follow me" tool to build a face,
then I move it to another place, and use move and scale to modify the curves,
then I want to do "Edge follow me" again

so the idea comes:------this tool have a function: ignore the move, scale, rotate, line, arc, rectangle, circle...(because they are so useful and they have shortcuts), but recall edge follow me, blend, extrapolate colors...(you must find it in a submenu).
On my bad English... hope you get my meaning... :enlight:
paranoia is a higher form of awareness...
mirale999
 
Posts: 24
Joined: Wed Oct 28, 2009 4:14 pm

Re: [Plugin] Recall last tool v1.2

Postby Matt666 » Mon Sep 12, 2011 8:41 am

Hi mirale999!
So you want RLT ignores some native tools you would be able to choose? Do you agree with this "way of explanation" (I dont know how to tell it in english :oops: )?
I don't know if it's possible... But I can try.
Frenglish at its best !
My scripts
Matt666
 
Posts: 829
Joined: Wed Dec 05, 2007 8:38 am
Location: 48.1184, -1.675
Name: Matt

Re: [Plugin] Recall last tool v1.2

Postby jdtsmith » Sat Feb 04, 2012 7:48 am

Just an FYI for any Mac users. Pecan's version above with the "exceptions" list works fine for me in SU 8.0. I use it with BetterTouchTool and a Magic Trackpad:

  • Three Finger TipTap Left: Orbit (O)
  • 3 Finger Tip Tap Right: Recall Last Tool (which I have as F2)
  • Pinch Out: Zoom Extents (I have as Shift-Z)

This plugin, with Lion's native three finger dragging make using SU with the trackpad much more enjoyable. Here's how I use it:

  • Two finger "scroll": zooms in and out
  • 3 Finger move: same as click and drag for selection
  • Tip Tap Left (drop two fingers and tap another to the left): switch to orbit tool
  • Tip Tap Right: switch back to whichever tool I'm in the middle of using
  • Get Lost? Pinch to Zoom Out

Thanks to the plugin's authors!
jdtsmith
 
Posts: 1
Joined: Mon Jun 23, 2008 12:34 am

Re: [Plugin] Recall last tool v1.2

Postby alex_picas » Wed Jul 11, 2012 8:12 pm

Hi Matt. Recall command of autocad is good too. Can you do other 'last tool recall' version like autocad with using only a space bar? Thanks Matt.
alex_picas
 
Posts: 1
Joined: Wed Sep 01, 2010 1:06 pm
Name: alex_picas

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Are you a Premium Member? Get your freebies here. Are you not a Premium Member yet? Upgrade your account to grab these freebies instantly.

Ad Machine
Robot
 
Posts: 2012

Next

Return to Plugins

Who is online

Users browsing this forum: hotice123, OrionF and 8 guests