sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [QUE] Why doesn't this draw the polyline?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 433 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.
    • H Offline
      herodes
      last edited by

      I found this example in the Wiki Api documentation pages.

      Link Preview Image
      Bitly | Page Not Found | 404

      favicon

      (bit.ly)

      model = Sketchup.active_model
      view = model.active_view
      
      point12 = Geom;;Point3d.new 0,0,0
      point13 = Geom;;Point3d.new 10,10,10
      point14 = Geom;;Point3d.new 20,20,20
      point15 = Geom;;Point3d.new 30,30,30
      
      status = view.draw_polyline point12, point13, point14, point15
      

      as it seems the polyline instructed isn't getting drawn.
      Is there something I am missing? Anything to watch out for?

      %(#BFBFBF)[http://arhitektonas.blogspot.com
      I know me,... I am that guy...
      ]

      1 Reply Last reply Reply Quote 0
      • Didier BurD Offline
        Didier Bur
        last edited by

        Hi,
        Lot of ruby examples are wrong in the docs...
        I guess that a polyline must have coplanar points, and these aren't ?

        DB

        1 Reply Last reply Reply Quote 0
        • H Offline
          herodes
          last edited by

          Hi Didier,

          model = Sketchup.active_model
          view = model.active_view
          
          # coplanar since z =0 on all these points...
          point12 = Geom;;Point3d.new 0,0,0 # z = 0
          point13 = Geom;;Point3d.new 10,10,0 # z = 0
          point14 = Geom;;Point3d.new 10,20,0 # z = 0
          point15 = Geom;;Point3d.new 10,30,0 # z = 0
          
          status = view.draw_polyline point12, point13, point14, point15
          

          I tried this and it stil doesn't work, I also gave inputting an array for argument to the draw_polyline and it gives a Sketchup::View,..
          ... any other ideas ?

          %(#BFBFBF)[http://arhitektonas.blogspot.com
          I know me,... I am that guy...
          ]

          1 Reply Last reply Reply Quote 0
          • fredo6F Offline
            fredo6
            last edited by

            [EDIT] after some quick test

            view.draw_polyline works fine, but are you sure you execute your code within the drawmethod of a Tool (this is the only place where view.draw methods can work)?

            Otherwise, if you want to draw a polyline, you could also use view.draw GL_LINESTRIP, pt1, pt2, ...

            If you want to draw segments with each pair of points, use view_draw_lineor view.draw_lines. Very handy to draw in one shot a complex shape that you pre-calculated.

            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