[OpenSCAD] Help with polygon() function

Andrew Plumb andrew at plumb.org
Tue Apr 21 08:01:49 EDT 2015


Path is a vector-of-index-vectors, not a vector-of-indices. You need to wrap it in a second set of ‘[]’:

—snip--

point = [[-36.6025, 136.603], [-136.603, 36.6025], [-100, -100], [36.6025,
-136.603], [136.603, -36.6025], [100, 100], [-60, 60], [-81.9615, -21.9615],
[-21.9615, -81.9615], [60, -60], [81.9615, 21.9615], [21.9615, 81.9615]];
path = [[0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]];

polygon(points=point, paths=path);

—end-snip--

Andrew.


> On Apr 21, 2015, at 7:41 AM, cn145912 <neil.penning+openscad at gmail.com> wrote:
> 
> I wrote some code to generate a polygon, it generates these two lists
> 
> point = [[-36.6025, 136.603], [-136.603, 36.6025], [-100, -100], [36.6025,
> -136.603], [136.603, -36.6025], [100, 100], [-60, 60], [-81.9615, -21.9615],
> [-21.9615, -81.9615], [60, -60], [81.9615, 21.9615], [21.9615, 81.9615]]
> path = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]
> 
> but for some reason, when I try
> 
> polygon(points=point, paths=path)
> 
> nothing is displayed. Could someone take a look at the lists and tell my why
> they don't work?
> 
> 
> 
> --
> View this message in context: http://forum.openscad.org/Help-with-polygon-function-tp12453.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> 
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





More information about the Discuss mailing list