sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    Invoke draw(view) method on tool startup

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 239 Views
    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.
    • T Offline
      tomasz
      last edited by

      Hi,
      Is there a way to invoke the draw(view) method of a tool immediately on a tool startup?
      When I start my tool I want to draw some lines on the screen. Although the tool initializes correctly, the draw method is not started. I need to zoom in\out or minimize\maximize SU window to get the draw method fire up.

      What am I doing wrong or what I am not doing which I should?
      Tomasz

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

        It's and annoying limitation that activate doesn't have a view argument.

        What I end up doing is:

        
        def activate
          Sketchup.active_model.active_view.invalidate
        end
        
        

        Some times, I've left it out, as my mouse move event continuously require the viewport to redraw.

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

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

          As Thomthom said - at the start of the activate code invalidate the view - that's the same as zooming ?

          TIG

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

            Changing the viewport cause it to invalidate and trigger the draw events.

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

            1 Reply Last reply Reply Quote 0
            • T Offline
              tomasz
              last edited by

              @thomthom said:

              What I end up doing is:

              
              > def activate
              >   Sketchup.active_model.active_view.invalidate
              > end
              > 
              

              Thanks. It has done the trick.
              I've been trying

              def activate
                   draw(Sketchup.active_model.active_view)
              end
              

              πŸ˜„ , but it has not worked.

              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

              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