sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Push_tool

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 263 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      ArunYoganandan
      last edited by

      Hello,

      I'm trying to temporarily switch to SU native selection tool on a key depress, do my seleections and return back to my tool on key release. From searching around, it looks like
      push_tool and pop_tool might do the trick.
      Dan Rathbun mentions here
      that the parameter is a UI::Tool class object. Is there a way to get this value for the native selection tool?

      Thanks,
      Arun

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        Afraid not, pop_tool and push_tool is for Ruby tools only.
        Maybe you can use the ToolsObserver or the SelectionObserver to reactivate your own tool?

        Btw, why do you need to temporarily switch to the native selection tool?

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          The SelectionTool is not an "interruptor" type tool (like the various Zoom, Orbit and Pan tools.)

          You can program single item select into your tool using Sketchup::PickHelper class.

          What many people do is have a custom tool command appear on the right-click context menu, but only if they are items in the selection set. Ie:
          unless Sketchup::active_model.selection.empty?

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            By the way,... you can activate the SelectionTool two ways:

            model = Sketchup.active_model model.select_tool(nil)

            or...
            Sketchup.send_action("selectSelectionTool:")

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • A Offline
              ArunYoganandan
              last edited by

              Thanks guys. Yes, I was doing a pickhelper or ray intersection and figuring out the object being clicked on and added it to the global selection. That worked fine, but only allowed selecting one entity at a time. I wanted to switch to select tool so I can use the group selection features that are available in it. Like thomthom suggested, I managed to get that working by backing up the current tool before doing Sketchup.send_action("selectSelectionTool:") and then restoring the older tool on release. This probably won't retain the tool state since I'm actually exiting the tool and re-entering, but it seems to work for my purpose.

              Thanks again!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement