为什么 Polyhedron 单独渲染效果很好,但不能与完整模型结合使用

Why does Polyhedron render well on its own but not in combination with complete model

下面的代码试图制作一个简单的 3d 三角形作为较大模型的侧面支撑。

它本身运行良好,但是当我将它添加到更大的模型时,三角形的其中一条边没有渲染,我收到 "UI-WARNING: Object may not be a valid 2-manifold and may need repair!"[= 的警告24=]

更奇怪的是,当我单击 "save" 时,模型被重新绘制,模型显示完整,但缺少一侧。

我正在使用 OpenScad v.2019.05

我正在通过在它们周围制作一些小物体和 hull() 来解决这个问题。但是,我希望这段代码能够工作。

//For some odd reason, this module works well on its own.
//It does does not render correctly when used as part of a larger model.
//Then it will miss a side.
//It shows correctly up when saving though. 

module supportTriangle(height=10, length=10, thickness=10){
    trianglePoints = [
    [ 0, 0, 0 ],
    [ thickness, 0, 0 ],
    [ 0, 0, height ],
    [ thickness, 0, height],
    [ 0, length, 0],
    [ thickness, length, 0]];

    triangleFaces = [
    [ 0, 1, 5, 4 ],
    [ 0, 1, 3, 2 ],
    [ 2, 3, 5, 4 ], 
    [ 0, 4, 2 ],
    [ 1, 3, 5 ]];

    polyhedron(trianglePoints, triangleFaces);

}

我在与较大的模型结合渲染时收到 "UI-WARNING: Object may not be a valid 2-manifold and may need repair!" 警告

试试这个:

module supportTriangle(height=10, length=10, thickness=10){
    trianglePoints = [
    [ 0, 0, 0 ],
    [ thickness, 0, 0 ],
    [ 0, 0, height ],
    [ thickness, 0, height],
    [ 0, length, 0],
    [ thickness, length, 0]];

    triangleFaces = [
    [ 0, 1, 5, 4 ], 
    [ 2,3,1,0], // i reversed these to keep them clockwise 
    [ 4,5,3,2 ], // i reversed these to keep them clockwise 
    [ 0, 4, 2 ],
    [ 1, 3, 5 ]];

    polyhedron(trianglePoints, triangleFaces);

}
supportTriangle(10,10,10);
cube(5,center=true); // just an extra thing to make it error if order is wrong

见: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#polyhedron 所有的面都必须有相同方向的点。当从外向内看每个面时,OpenSCAD 更喜欢顺时针 。背面是从背面看,底部是从底部看等等。