0

我有兴趣使用点网格构建六边形圆环吗?

我可以从一个二维多边形开始,然后迭代 360 次(1 度分辨率)来构建一个完整的实体。

这是最好的方法吗?我真正追求的是在其跨度上构建具有可变横截面几何形状的机翼轮廓。

4

2 回答 2

2

以您的方式您可以使用polyhedron(). 按定义的顺序将适当数量的点添加到向量“points”中,通过第二个向量“faces”中的点的索引定义面,并将两个向量设置为 中的参数polyhedron(),请参阅文档。您可以通过每个轮廓的点数和轮廓之间的距离(圆环中的扇区)来控制曲面的质量。

这里有一个示例代码:

// parameter:
r1 = 20;            // radius of torus
r2 = 4;         // radius of polygon/ thickness of torus
s = 360;            // sections per 360 deg
p = 6;          // points on polygon
a = 30;                 // angle of the first point on Polygon

// points on cross-section
// angle = 360*i/p + startangle, x = r2*cos(angle), y = 0, z = r2*sin(angle)
function cs_point(i) = [r1 + r2*cos(360*i/p + a), 0, r2*sin(360*i/p + a)];

// returns to the index in the points - vector the section number and the number of the point on this section
function point_index(i) = [floor(i/p), i - p*floor(i/p)];

// returns the points  x-, y-, z-coordinates by rotatating the corresponding point from crossection around the z-axis 
function iterate_cs(i) = [cs[point_index(i)[1]][0]*cos(360*floor(i/p)/s), cs[point_index(i)[1]][0]*sin(360*floor(i/p)/s), cs[point_index(i)[1]][2]];

// for every point find neighbour points to build faces, ( + p: point on the next cross-section), points ordered clockwise
// to connect point on last section to corresponding points on first section 
function item_add1(i) = i >= (s - 1)*p ? -(s)*p : 0; 
// to connect last point on section to first points on the same and the next section
function item_add2(i) = i - p*floor(i/p) >= p-1 ? -p : 0;
// build faces
function find_neighbours1(i) = [i, i + 1 + item_add2(i), i + 1 + item_add2(i) + p + item_add1(i)];
function find_neighbours2(i) = [i, i + 1 + + item_add2(i) + p + item_add1(i), i + p + item_add1(i)];

cs = [for (i = [0:p-1]) cs_point(i)];
points = [for (i = [0:s*p - 1]) iterate_cs(i)];
faces1 = [for (i = [0:s*p - 1]) find_neighbours1(i)];
faces2 = [for (i = [0:s*p - 1]) find_neighbours2(i)];
faces = concat(faces1, faces2);

polyhedron(points = points, faces = faces);

这里的结果:

在此处输入图像描述

由于 openscad 2015-03 面可以有超过 3 个点,如果面的所有点都在同一平面上。因此,在这种情况下,面孔也可以一步构建。

于 2018-02-12T22:05:03.967 回答
0

你在建造什么吗?像 NACA 翼型?https://en.wikipedia.org/wiki/NACA_airfoil

有一些 OpenSCAD 设计适合那些四处游荡的人,例如https://www.thingiverse.com/thing:898554

于 2018-02-07T23:13:58.530 回答