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 |
Hi. For optimal hull-ing and overall prettyness I'd rotate each sphere/point to the average angle between each pair of segments. 2017-11-18 0:48 GMT+01:00 Jordan Brown <[hidden email]>:
Regards,
Antonio _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
To render the union of a large set of primitives is usually very slow. Even the preview may be slow if you have thousands of facets. What you need is a sweep operator: given a path and a planar section, it builds a generalized cylinder along the path with the given section. Sweep operator usually does that by using the primitive polyhedron which is a lot faster than the union of many stuffs, but each sweep should not have self-intersections. That kind of sweep may be much faster but remember that the union of many sweeps may require some time to render. Look for Parkinbot's sweep in Thingverse or check sweep.scad and sweep examples in https://github.com/openscad/list-comprehension-demos. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
There's a Bezier curve library on Thingiverse which allows extruding a specific shape along a curve. On 18/11/2017 14:36, "Ronaldo Persiano" <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
There is are bezier extrusion type calls in my BOSL library that can sweep a 2D path perpendicularly along a 3D bezier path. It creates it as a polyhedron. Look for extrude_bezier_along_bezier() in BOSL/bezier.scad - Revar
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by JordanBrown
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 _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
The artifact that emerges from inflections disappears when $fn is even. The twist artifact may be fully eliminated with proper rotations of the circles and cylinders.
The variable $total_twist adds up the twists of a sequence of curved_pipe. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by frankv
On 2017-11-18 02:27, Frank van der Hulst wrote:
I've used spline libraries and skin () to create various curved handles, etc. for teapots. I create some control points, which also can specify size and angle (and distortion) of a circle, use splines to "smooth" this data, and then create the points to be skinned. All OpenSCAD code is there and there are urls of the various libraries used. https://www.thingiverse.com/thing:2590540 That shape you show should be perfectly doable and rendering should be *very* fast, particularly if you have a variable for how smooth to make the splines. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |