# Trouble drawing a polyhedron

5 messages
Open this post in threaded view
|

## Trouble drawing a polyhedron

 I am experimenting with drawing polyhedrons and encountered this problem. When I preview everything works, but when I render it the polyhedron doesn't draw properly.   If I draw only the polyhedron it works, but if I also draw another cube or something else it fails when rendering. Here is a bit of code: union(){     polyhedron(         points=[[0,0,0], [0,8,0], [4,0,0], [4,8,0], [4,0,4], [4,8,4]],         faces=[[0,1,3,2],[0,1,5,4],[5,4,2,3],[0,4,2],[1,5,3]]     );     translate([4,0,0]) cube([2,8,4],false); } What is going on here?  I'm not sure what I did wrong. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Trouble drawing a polyhedron

Open this post in threaded view
|

## Re: Trouble drawing a polyhedron

 In reply to this post by TacoSupreme I'm not a whiz when it comes to OpenSCAD, but I like challenges. I read the wiki page and have quoted a portion that applies here. I also created a crib sheet to help me understand the point and faces of the model described.The CW aspect was missed on three faces. Once corrected, all is good.union(){    polyhedron(        points=[[0,0,0], [0,8,0], [4,0,0], [4,8,0], [4,0,4], [4,8,4]],        //faces=[[0,1,3,2],[0,1,5,4],[5,4,2,3],[0,4,2],[1,5,3]]        faces=[[0,2,3,1],[0,1,5,4],[5,3,2,4],[0,4,2],[1,3,5]]    );   translate([4,0,0]) cube([2,8,4],false);}/*points0 - 0 0 0 = origin1 - 0 8 0 = top left flat2 - 4 0 0 = lower right flat3 - 4 8 0 = upper right flat   4 - 4 0 4 = top point front5 - 4 8 4 = top point rearfaces bottom rectangle0132 = origin, top left flat, upper right flat, lower right flatleft angled rectangle0154 = origin, top left flat, top point rear, top point frontvertical right rectangle5423 = top point rear, top point front, lower right flat, upper right flatfront triangle042 = origin, top point front, lower right flatrear triangle153 = top left flat, top point rear, upper right flatWhen viewed from the outside, the points describing each face must be in the same order . OpenSCAD prefers CW, and provides a mechanism for detecting CCW. When the thrown together view (F12) is used with F5, CCW faces are shown in pink. Reorder the points for incorrect faces. Rotate the object to view all faces. The pink view can be turned off with F10. */ On Wednesday, January 23, 2019, 5:05:52 PM EST, TacoSupreme <[hidden email]> wrote: I am experimenting with drawing polyhedrons and encountered this problem.When I preview everything works, but when I render it the polyhedron doesn'tdraw properly.  If I draw only the polyhedron it works, but if I also drawanother cube or something else it fails when rendering.Here is a bit of code:union(){    polyhedron(        points=[[0,0,0], [0,8,0], [4,0,0], [4,8,0], [4,0,4], [4,8,4]],        faces=[[0,1,3,2],[0,1,5,4],[5,4,2,3],[0,4,2],[1,5,3]]    );    translate([4,0,0]) cube([2,8,4],false);}What is going on here?  I'm not sure what I did wrong.--Sent from: http://forum.openscad.org/_______________________________________________OpenSCAD mailing list _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org