This could be a middle ground between what you have and the other proposals:

module curved_pipe(r = 1, h = 1, curve_angle = 0, curve_radius = 0, twist = 0) {

off = r + curve_radius;

er = curve_angle == 0 ? 0 : 90 * (1 - sign(curve_angle));

rotate([0, 0, twist + er]) {

cylinder(r = r, h = h);

translate([-off, 0, h]) rotate([90, 0, 0])

rotate_extrude(angle = abs(curve_angle))

translate([off, 0, 0]) circle(r = r);

translate([-off, 0, h]) rotate([0, -abs(curve_angle), 0])

translate([off, 0, 0]) rotate([0, 0, er]) children();

}

}

Basically a parametric cylinder, plus a curved connection element, that connects itself to

its children (note that there is only one semicolon after each example).

can be used like here:

curved_pipe(h = 5, curve_angle = -72, curve_radius = 5)

curved_pipe(h = 5, curve_angle = -72, curve_radius = 5)

curved_pipe(h = 5, curve_angle = -72, curve_radius = 5)

curved_pipe(h = 5, curve_angle = -72, curve_radius = 5)

curved_pipe(h = 5, curve_angle = -72, curve_radius = 5);

or just with curved elements

curved_pipe(h = 0, curve_angle = 30, curve_radius = 1)

curved_pipe(h = 0, curve_angle = 30, curve_radius = 3)

curved_pipe(h = 0, curve_angle = 10, curve_radius = 5)

curved_pipe(h = 0, curve_angle = 40, curve_radius = 7)

curved_pipe(h = 0, curve_angle = 60, curve_radius = 9);

If you want to define the elements in an array use eg.:

module curved_pipe_path(parameters, index = 0) {

if(index < len(parameters)) {

element = parameters[index];

curved_pipe(r = 5, h = element[0], curve_angle = element[1])

curved_pipe_path(parameters, index = index + 1);

}

}

params = [[5, 52], [5, 62], [5, 72], [5.7, 82], [7.9, 92]];

curved_pipe_path(params);

Limitations: Artifacts are created if you use twist and/or positive and negative curvature

in the same object. To avoid them ensure that fundamental circle is made of 360/twist

elements (or a multiple of that), ge. using $fn.

--

Roland

**Gesendet:** Samstag, 18. November 2017 um 00:48 Uhr

**Von:** "Jordan Brown" <

[hidden email]>

**An:** "OpenSCAD general discussion" <

[hidden email]>

**Betreff:** [OpenSCAD] connecting cylinders at arbitrary angles

In order to make things like this:

I have a module that takes a list of points and connects them with cylinders, with spheres at the junctions.

Geometrically, those junctions would be perfect and smooth. However, given the quantization of round things, it's not so good:

Preview performance on this model is awful, and it takes ~13 minutes to render. I have to wonder whether some of that performance is due to having to manage all of these little microstructures.

Increasing the resolution of the round things makes the result prettier, but slows down rendering because it's just trading these ugly microstructures for a larger number of prettier microstructures.

Anybody have any ideas or tricks for doing this in a way that performs well?

(Probably the real answer for this particular case, where the diameter is only 2mm, is to model these round pieces as rectangles; in theory that would mean something like 12 triangles per segment. However, that's not very satisfying in the general case.)

_______________________________________________ OpenSCAD mailing list

[hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org