Hello,
I am trying to extrude shapes linearly but with a curvy profile, not a linear one. Currently, I've succeeded globally by stacking linear extrusions and using a 2d vector for the embedded scaling but it's a bit complicated. <http://forum.openscad.org/file/t2715/curvy_extrusion.jpg> I couldn't find a good library to achieve this but maybe I haven't looked at the right place... -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
It's a little bit unclear what exactly you want to do. But there's likely
already existing libraries that do it. Several libraries have a sweep operation of some sort that constructs a solid by linking together transformations of an initial polygon. Some that I'm aware of are the original list-comprehension-demos, dotSCAD and BOSL2. The first one is old and has some issues with the latest version of openscad. A basic sweep concept is to take a polygon and "sweep" it along a curved path, line a linear extrude that follows a nonlinear path. (There's quite a bit of hidden complexity having to do with orientation of the polygon, however.) The most general sweep concept is to use a series of arbitrary transformation operators to define a sequence of polygons. Another operation is to link together a sequence of polygons that might be unrelated, so a square could morph into a circle, or perhaps a hexagon. List-comprehension-demos included a skin() operator which does this (sort of) and BOSL2 includes code that can handle polygons with dissimilar numbers of vertices. BOSL2 also includes offset_sweep which constructs a polyhedron by a sequence of offset operations. This is useful for creating a shape with a constant wall thickness. For BOSL2 skin, sweep and path_sweep see: https://github.com/revarbat/BOSL2/wiki/skin.scad And for offset_sweep: https://github.com/revarbat/BOSL2/wiki/rounding.scad#offset_sweep Other references: https://github.com/RonaldoCMP/list-comprehension-demos https://github.com/JustinSDK/dotSCAD -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I 've tried with sweep but I've had some issues so I have finally tried with
a for loop and linear_extrude. I've just managed to do it. Happy! // essai scale linear_extrude length = 100; width = 40; height = 10; edge_thickn = 10; // length and width at bottom start_l = length - 2 * edge_thickn; start_w = width - 2 * edge_thickn; // difference between top and bottom (delta) diff_l = length - start_l; diff_w = width - start_w; steps = 50; for(i = [0:steps-1]) { z_pos = i/steps * height; step_height = height/steps; local_start_l = i/steps * diff_l + start_l; local_start_w = i/steps * diff_w + start_w; local_target_l = (i+1)/steps * diff_l + start_l; local_target_w = (i+1)/steps * diff_w + start_w; local_l_factor = local_start_l/local_target_l; local_w_factor = local_start_w/local_target_w; color( c = [sqrt(1 - i/(steps- 1)), sqrt(i/(steps-1)), sqrt(i/(steps-1)), 1.]) translate([0,0,z_pos]) linear_extrude(step_height, convexity = 10, slices = 1, scale = [1/local_l_factor, 1/local_w_factor]) resize([local_target_l * local_l_factor, local_target_w * local_w_factor, 1]) square([1, 1], center = true); } -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Is this all about the color? Because the geometry in your example has no
curves and can be produced by a single linear_extrude call: linear_extrude(height=height, scale = [length/start_l, width/start_w]) translate(-[start_l,start_w]/2)square([start_l, start_w]); -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by amundsen
You want this?
use <bezier_curve.scad>; use <hull_polyline3d.scad>; use <sweep.scad>; use <paths2sections.scad>; t_step = 0.1; width = 2; p0 = [50, 10, 0]; p1 = [45, 5, 7.5]; p2 = [45, 5, 15]; curvy_profile1 = bezier_curve(t_step, [p0, p1, p2]); curvy_profile2 = [for(p = curvy_profile1) [-p[0], p[1], p[2]]]; curvy_profile3 = [for(p = curvy_profile1) [-p[0], -p[1], p[2]]]; curvy_profile4 = [for(p = curvy_profile1) [p[0], -p[1], p[2]]]; sections = paths2sections([ curvy_profile1, curvy_profile2, curvy_profile3, curvy_profile4 ]); #hull_polyline3d(curvy_profile1, width); sweep(sections); <http://forum.openscad.org/file/t1825/demo.jpg> ----- https://openhome.cc -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by amundsen
Em sex., 26 de jun. de 2020 às 19:44, amundsen <[hidden email]> escreveu: I 've tried with sweep but I've had some issues so I have finally tried with Your Idea is good but there is no curvature in the rising edges. I guess your intention might be something like this:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by adrianv
@adrianv you're right the pasted example was linear and I've achieved this
but not with that code but to me the trickiest part was to manage the growth for each layer. The model shown the picture below was made with a similar code using a sine profile for the inner curve. @caterpillar very interesting and concise. However I had to modify the calls to libraries like this to make it function: use <dotSCAD/src/bezier_curve.scad>; use <dotSCAD/src/hull_polyline3d.scad>; use <dotSCAD/src/sweep.scad>; use <dotSCAD/src/paths2sections.scad>; Thank you everyone. <http://forum.openscad.org/file/t2715/curvy_extrusion_2.jpg> -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by amundsen
My tubemesh library allows you to do that with a lot of flexibility:
https://www.thingiverse.com/thing:2406760 -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |