【发布时间】:2023-01-15 08:32:03
【问题描述】:
我有以下代码旨在以五角星图案挤出五角星:
pentp =
[ for (j = [0 : 144 : 719]) [sin(j)+1.5, cos(j)]
];
union() {
for (i = [0 : 144 : 719]) {
rotate([0,0,i]) rotate_extrude(angle = 288, $fn=2) polygon(pentp);
};
};
预览看起来正确:
所以我想渲染它并导出,这样我就可以在 Blender 中生成漂亮的渲染图。当我点击渲染时,我得到一些几何错误:
Rendering Polygon Mesh using CGAL...
ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.
ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.
ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.
ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.
ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.
Geometries in cache: 63
Geometry cache size in bytes: 178448
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0:00:00.021
WARNING: No top level geometry to render
看到错误并不奇怪,因为我试图渲染的形状非常不凸,但我不完全确定网格有什么没有闭合。通过一些实验,我发现问题似乎出在挤压五角星上。
如果我切换到挤压五边形,则没有错误:
pentp =
[ for (j = [0 : 72 : 359]) [sin(j)+1.5, cos(j)]
];
union() {
for (i = [0 : 144 : 719]) {
rotate([0,0,i]) rotate_extrude(angle = 288, $fn=2) polygon(pentp);
};
};
如果我以五边形图案挤出五角星,错误仍然存在:
pentp =
[ for (j = [0 : 144 : 719]) [sin(j)+1.5, cos(j)]
];
union() {
for (i = [0 : 144 : 719]) {
rotate([0,0,i]) rotate_extrude(angle = 72, convexity=10, $fn=2) polygon(pentp);
};
};
但是,当我仅使用一个 rotate_extrude 以五边形图案挤出五角星时,没有错误:
pentp =
[ for (j = [0 : 144 : 719]) [sin(j)+1.5, cos(j)]
];
rotate_extrude(angle=360, $fn=5) polygon(pentp);
然而,据我所知,rotate_extrude 似乎无法单独挤压成五角星形。
我可以看到在使用非凸多边形和导致问题的我的盗版挤压方面存在一些融合。但是我无法确定它,也没有办法修复它。
我的初始代码有什么问题。
【问题讨论】:
标签: cgal cad 3d-modelling openscad