I am running into what honestly seems like a bug in OpenSCAD, but I can't believe that something so simple could reveal a bug. I am trying to render the following code:
module tri_prism(base1, base2) {
polyhedron([
base1[0], base1[1], base1[2],
base2[0], base2[1], base2[2]],
[[0,1,2],[3,4,5],
[0,1,4,3],[1,2,5,4],[2,0,3,5]],
convexity=5);
}
union() {
tri_prism(
[[0,0,0],[0,1,0],[1,0,0]],
[[0,0,1],[0,1,1],[1,0,1]]);
tri_prism(
[[2,1,0],[2,0,0],[1,1,0]],
[[2,1,1],[2,0,1],[1,1,1]]);
}
This should render two (non-overlapping) triangular prisms, like so:
However, this image is only the preview. When I hit F6, it renders this, with only the triangular bases being rendered:
And the console shows this warning, which I don't know the meaning of because I am a beginner:
UI-WARNING: Object may not be a valid 2-manifold and may need repair!
Each of the prisms individually renders just fine, but the two of them together don't. Also, it is not merely a problem of appearance since exporting it as STL and opening it in Cura, I see the same useless nonsense.
Is this a bug or am I doing something wrong? And if it is a bug, how do I work around it?