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

    Quit Current Tool

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 194 Views 4 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.
    • daikuD Offline
      daiku
      last edited by

      I'm creating a tool, and there are certain situations where it's inappropriate to use the tool (the user does not have the correct type of component selected). I can display an error message easily enough, but how do I then quit the tool? CB.

      Clark Bremer
      http://www.northernlightstimberframing.com

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        hm... I've not used it - but maybe Tools.pop_tool?
        http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/tools.html#pop_tool

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          You could use a validation_proc to enable/disable the Tool button and/or menu. There would not be an opportunity to open a message box - the tool would simple not be available.

          Hi

          1 Reply Last reply Reply Quote 0
          • daikuD Offline
            daiku
            last edited by

            Yes, validation_proc is the correct solution for me. Don't even start the tool if we're not in the correct state. Thanks, Jim. CB.

            Clark Bremer
            http://www.northernlightstimberframing.com

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              Best to stop the tool running if the circumstances are wrong.
              Assuming that you can select the 'wrong thing' within the tool later...
              After your error message...

              Sketchup.send_action("SelectSelectTool;")
              return nil
              

              should do it ?
              Appropriate if you error message says to select something better / different ??

              TIG

              1 Reply Last reply Reply Quote 0
              • daikuD Offline
                daiku
                last edited by

                Thanks Tig. My tools are specific to a very specialized group of users (timber framers), so they'll know what should be selected. I think having the tool grayed out on the menu is all I need to do. CB.

                Clark Bremer
                http://www.northernlightstimberframing.com

                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