Search code examples
3dmeshopenscad

OpenSCAD: Do polyhedron faces have to be on the same plane?


I am currently trying to use OpenSCAD to create a ramp in a cylindrical shape:

a ramp cam built in OpenSCAD

(The code is here: https://bitbucket.org/snippets/robertmassaioli/5RBnp)

But I am currently getting errors when I try and generate an STL file. I think that might be because I am trying to generate this surface using quad faces but the docs say that all faces must be points along a plane:

When referencing more than 3 points in a single tuple, the points must all be on the same plane.

However, doing some basic maths I can see that the points between the inner loop and the outer loop do not form a plane. I think that is why you can see the obvious triangulation on the largest face in the image above. When I try and turn it into an STL file this happens:

rendering error in OpenSCAD

However, if OpenSCAD notices that my faces will not work unless they are triangulated then should it not just convert my n-gons into triangles automatically? It seems to be doing that anyway for the preview panel.

The ultimate question is: am I right in thinking that this is my problem and why does not OpenSCAD fix it up automatically for me?


Solution

  • Okay, it turns out that I just had my faces wound in the wrong direction. I fixed that up and improved the code slightly and now it all works flawlessly.

    You can see the details of what it took to fix the issue here: https://github.com/openscad/openscad/issues/1435