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

    Anyone know what's wrong with the linetool example?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 198 Views 2 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.
    • I Offline
      iceman
      last edited by

      I'm pretty new at this, sorry. I've been looking at the linetool.rb script that comes with SU, and I'm having trouble with it. When the tool is in the "picking second point" state, and its draw method is being called, the line that's drawn between the first point and the current mouse location is not always "complete". That is, the line extends from the first point to a point in between the first point and my mouse and stops. When I click to select the second point, the construction line that the tool is supposed to draw works fine. It's only the temporary graphics in between selecting the first and second point. I modified the draw method to use view.draw_points to draw the first point and the point where the mouse is currently, and the points show up in the right place. Am I missing something? What is wrong with this example?

      http://farm4.static.flickr.com/3658/3427528652_b0d613d9f4.jpg

      The point just floating out there is where my mouse pointer was when I took the screenshot.

      1 Reply Last reply Reply Quote 0
      • W Offline
        Whaat
        last edited by

        Hi iceman,

        I think the problem is that the linetool does not implement the 'getExtents' method. If you add this method to the tool, and make sure that it returns a bounding box that includes the position of BOTH inputpoints, then the tool should draw the preview line as expected.

        http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Tool.html#getExtents

        This should work:

        def getExtents
        
        bounds=Sketchup.active_model.bounds
        bounds.add(@ip.position)   #add the input point position to the bounding box
        return bounds
        
        end
        

        SketchUp Plugins for Professionals

        1 Reply Last reply Reply Quote 0
        • I Offline
          iceman
          last edited by

          Thanks, Whaat. That did the trick. So the reason behind this is that SU was only invalidating a default area of the screen around the first point because I didn't implement getExtents?

          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