下面的代码试图使一个简单的3D三角形在较大型号的侧面支持时工作。
它自己运行良好,但是当我将其添加到更大的模型中时,三角形的一个侧面没有呈现,我会收到的警告" UI-Warning:对象可能不是有效的2-manifold,可能需要维修!"
使其甚至是陌生人,当我单击"保存"时,该模型被重新绘制,并且模型显示为缺失的侧面。
我正在使用openscad v.2019.05
我正在解决问题,并在它们周围制作一些小物体和船体((。但是,我希望此代码可以工作。
//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:对象可能不是有效的2个manifold,可能需要维修!"当渲染与较大模型
尝试以下:
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/primive_solids#polyhedron所有面都必须在相同方向上排序点。OpenSCAD更喜欢顺时针从外部向外看每个脸时。从背面,底部从底部观看,等等。