• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Script and custom tool work together ?

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 293 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.
  • D Offline
    Didier Bur
    last edited by 20 Jun 2010, 20:26

    Hi,
    Is this possible ?

    1. Start a script execution
    2. Pause the script and launch a custom tool (such as a "getpoint" tool for instance and return the clicked Point3D)
    3. Resume the main script and use the Point3D variable.
    
    #start script
    #...
    point=Sketchup.active_model.select_tool MyGetPointTool.new
    #...
    # resume script
    
    

    The problem is that if it is not possible, one has to encapsulate all the script in the tool itself.

    Any hint someone ❓

    DB

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 20 Jun 2010, 20:32

      Pretty sure you can't pause it.

      You don't have to encapsulate the entire script into the Tool class, just make the Tool's deactivate event trigger your main script again.

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

      1 Reply Last reply Reply Quote 0
      • D Offline
        Didier Bur
        last edited by 20 Jun 2010, 22:15

        Hi tt,

        @unknownuser said:

        make the Tool's deactivate event trigger your main script

        Sorry, but how to do that ?

        
        def deactivate()
        ????
        end
        
        

        DB

        1 Reply Last reply Reply Quote 0
        • C Offline
          Chris Fullmer
          last edited by 20 Jun 2010, 22:27

          yeah, exactly.

          def deactivate my_script end

          Just have it call your script again when it de-activates. You could even set up your script to accep arguments so you can send in the point3d.

          Chris

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

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 21 Jun 2010, 06:01

            Something like:

            module MyModule
            
              def some_method
                # lalala
                Sketchup.active_model.tools.push( MyTool.new )
              end
              
              def continue(args)
                # lalala
              end
              
              class MyTool
                
                # Collect data...
                
                def deactivate
                  MyModule.continue(args)
                end
              end
            

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

            1 Reply Last reply Reply Quote 0
            • D Offline
              Didier Bur
              last edited by 21 Jun 2010, 09:27

              Cool, thanks a million 😍

              DB

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

              Advertisement