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

    Ending a tool

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 5 Posters 550 Views 5 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.
    • Q Offline
      Qverburg
      last edited by

      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
      end

      But 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

      1 Reply Last reply Reply Quote 0
      • Q Offline
        Qverburg
        last edited by

        Solved it with a Sketchup.send_action("selectSelectionTool:").

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          Excellent, glad you got it working. It sounded like you were looking for something much complicated than activating the selection tool.

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

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

            @qverburg said:

            Solved it with a Sketchup.send_action("selectSelectionTool:").

            I end most of my complex tools with that....

            TIG

            1 Reply Last reply Reply Quote 0
            • AdamBA Offline
              AdamB
              last edited by

              @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

              Developer of LightUp Click for website

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

                @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

                1 Reply Last reply Reply Quote 0
                • AdamBA Offline
                  AdamB
                  last edited by

                  @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. πŸ˜„

                  Developer of LightUp Click for website

                  1 Reply Last reply Reply Quote 0
                  • Q Offline
                    Qverburg
                    last edited by

                    @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

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

                      @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.
                      Adam

                      Do yo have to use Sketchup.active_model.tools.push_tool to activate the tool then? Because I tried Sketchup.active_model.tools.pop_tool when I had activated the tool using Sketchup.active_model.tools.select_tool - and that did not seem to do anything.

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

                      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