在 openSCAD 中用多面体创建 "cup"
Creating a "cup" with polyhedra in openSCAD
我正在尝试用八角棱柱(使用 polyhedron
函数)创建一个 "cup" 形状(空心,一端开口)。当我渲染我的代码时,OpenSCAD 不会渲染底面和内面。我做错了什么?
谢谢!
我的代码:
difference() {
polyhedron(points = [ [21.5,51.9,0],[51.9,21.5,0],
[-21.5,51.9,0],[-51.9,21.5,0],
[-21.5,-51.9,0],[-51.9,-21.5,0],
[21.5,-51.9,0],[51.9,-21.5,0],
[21.5,51.9,100],[51.9,21.5,100],
[-21.5,51.9,100],[-51.9,21.5,100],
[-21.5,-51.9,100],[-51.9,-21.5,100],
[21.5,-51.9,100],[51.9,-21.5,100] ], faces = [
[0,1,9,8],[2,0,8,10],[3,2,10,11],[5,3,11,13],
[4,5,13,12],[6,4,12,14],[7,6,14,15],[1,7,15,9],
[0,1,7,6,4,5,3,2],[8,9,15,14,12,13,11,10] ]);
polyhedron(points = [ [19,49.4,5],[49.4,19,5],
[-19,49.4,5],[-49.4,19,5],
[-19,-49.4,5],[-49.4,-19,5],
[19,-49.4,5],[49.4,-19,5],
[19,49.4,100],[49.4,19,100],
[-19,49.4,100],[-49.4,19,100],
[-19,-49.4,100],[-49.4,-19,100],
[19,-49.4,100],[49.4,-19,100] ], faces = [
[0,1,9,8],[2,0,8,10],[3,2,10,11],[5,3,11,13],
[4,5,13,12],[6,4,12,14],[7,6,14,15],[1,7,15,9],
[0,1,7,6,4,5,3,2],[8,9,15,14,12,13,11,10] ]);
}
我的渲染问题的图像:
如果您使用 polyhedron()
,您应该始终按照此处所述检查面部的方向:
documentation openscad
你会看到,在这两种情况下 bottom-face 的方向都是错误的,这里你的内部 polyhedron()
:
将 bottom-face 的 [0,1,7,6,4,5,3,2]
替换为 [2,3,5,4,6,7,1,0]
,您就得到了杯子:
我正在尝试用八角棱柱(使用 polyhedron
函数)创建一个 "cup" 形状(空心,一端开口)。当我渲染我的代码时,OpenSCAD 不会渲染底面和内面。我做错了什么?
谢谢!
我的代码:
difference() {
polyhedron(points = [ [21.5,51.9,0],[51.9,21.5,0],
[-21.5,51.9,0],[-51.9,21.5,0],
[-21.5,-51.9,0],[-51.9,-21.5,0],
[21.5,-51.9,0],[51.9,-21.5,0],
[21.5,51.9,100],[51.9,21.5,100],
[-21.5,51.9,100],[-51.9,21.5,100],
[-21.5,-51.9,100],[-51.9,-21.5,100],
[21.5,-51.9,100],[51.9,-21.5,100] ], faces = [
[0,1,9,8],[2,0,8,10],[3,2,10,11],[5,3,11,13],
[4,5,13,12],[6,4,12,14],[7,6,14,15],[1,7,15,9],
[0,1,7,6,4,5,3,2],[8,9,15,14,12,13,11,10] ]);
polyhedron(points = [ [19,49.4,5],[49.4,19,5],
[-19,49.4,5],[-49.4,19,5],
[-19,-49.4,5],[-49.4,-19,5],
[19,-49.4,5],[49.4,-19,5],
[19,49.4,100],[49.4,19,100],
[-19,49.4,100],[-49.4,19,100],
[-19,-49.4,100],[-49.4,-19,100],
[19,-49.4,100],[49.4,-19,100] ], faces = [
[0,1,9,8],[2,0,8,10],[3,2,10,11],[5,3,11,13],
[4,5,13,12],[6,4,12,14],[7,6,14,15],[1,7,15,9],
[0,1,7,6,4,5,3,2],[8,9,15,14,12,13,11,10] ]);
}
我的渲染问题的图像:
如果您使用 polyhedron()
,您应该始终按照此处所述检查面部的方向:
documentation openscad
你会看到,在这两种情况下 bottom-face 的方向都是错误的,这里你的内部 polyhedron()
:
将 bottom-face 的 [0,1,7,6,4,5,3,2]
替换为 [2,3,5,4,6,7,1,0]
,您就得到了杯子: