Help with polygon() function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with polygon() function

cn145912
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Help with polygon() function

clothbot
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 <[hidden email]> 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
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Help with polygon() function

nophead
Renaming path to paths = [[ ... ]] or doing polygon(points=point, paths=[path]); makes the code more logical.

Similarly point should be points.