我有兴趣使用点网格构建六角形圆环?
我想我可以用二维多边形开始,然后迭代360次(1度分辨率)来构建一个完整的实体。
这是最好的方法吗?我真正想要的是在它的跨度上构建具有可变截面几何形状的机翼轮廓。
答案 0 :(得分:2)
以您的方式您可以使用polyhedron()
执行此操作。按照定义的顺序为每个轮廓添加适当数量的点到矢量“点”,通过第二个矢量“面”中的点的索引定义面,并将两个矢量设置为polyhedron()
中的参数,参见{{3 }}。您可以通过每个轮廓的点数和轮廓之间的距离(圆环扇形)来控制曲面的质量。
这是一个示例代码:
// 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个点。所以在这种情况下,face也可以一步构建。
答案 1 :(得分:0)
你在建造什么吗?像NACA翼型? https://en.wikipedia.org/wiki/NACA_airfoil
对于那些漂浮的人来说,有一些OpenSCAD设计,例如, https://www.thingiverse.com/thing:898554