• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Invoke draw(view) method on tool startup

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 3 Posters 239 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.
  • T Offline
    tomasz
    last edited by 11 Sept 2010, 09:28

    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
    • T Offline
      thomthom
      last edited by 11 Sept 2010, 09:41

      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
      • T Offline
        TIG Moderator
        last edited by 11 Sept 2010, 09:47

        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
        • T Offline
          thomthom
          last edited by 11 Sept 2010, 10:06

          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 11 Sept 2010, 10:13

            @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
            1 / 1
            • First post
              1/5
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement