[QUE] Why doesn't this draw the polyline?
-
I found this example in the Wiki Api documentation pages.
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? -
Hi,
Lot of ruby examples are wrong in the docs...
I guess that a polyline must have coplanar points, and these aren't ? -
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 ? -
[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.
Advertisement