Как сделать изогнутый лист (куб) в OpenSCAD? - PullRequest
0 голосов
/ 09 января 2019

Как я могу изогнуть лист (куб)? Я хотел бы контролировать угол изгиба / кривой.

curve

, например

кубик ([50,50,2]);

Ответы [ 2 ]

0 голосов
/ 10 января 2019

Вы можете rotate_extrude() прямоугольник с параметром угла. Для этого требуется версия openscad 2016.xx или новее, см. документацию . Необходимо установить снимок разработки, см. загрузить openscad

$fn= 360;

width = 10;   // width of rectangle
height = 2;   // height of rectangle
r = 50;       // radius of the curve
a = 30;       // angle of the curve

rotate_extrude(angle = a) translate([r, 0, 0]) square(size = [height, width], center = true);

выглядит так:

enter image description here

Кривая определяется радиусом и углом. Я думаю, что более реалистично использовать другие размеры, такие как длина или dh в этом наброске

enter image description here

и рассчитать радиус и угол

$fn= 360;

w = 10;       // width of rectangle
h = 2;       // height of rectangle
l = 25;      // length of chord of the curve
dh = 2;           // delta height of the curve

module curve(width, height, length, dh) {
    // calculate radius and angle
    r = ((length/2)*(length/2) - dh*dh)/(2*dh);
    a = asin((length/2)/r);
    rotate_extrude(angle = a) translate([r, 0, 0]) square(size = [height, width], center = true);
}

curve(w, h, l, dh);
0 голосов
/ 09 января 2019

Я могу сделать это таким образом, но было бы лучше, если бы вы указали изгиб / кривую в #degrees в качестве аргумента функции:

$fn=300;
module oval(w, h, height, center = false) {
 scale([1, h/w, 1]) cylinder(h=height, r=w, center=center);
}

module curved(w,l,h) {
    difference() {
      oval(w,l,h);
      translate([0.5,-1,-1]) color("red") oval(w,l+2,h+2);
    }
}


curved(10,20,30);
...