discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] alternative to hull?

RP
Ronaldo Persiano
Sat, Feb 18, 2017 2:23 PM

The idea is to define just one polyhedron for the whole model otherwise the
union will be lengthy.

The idea is to define just one polyhedron for the whole model otherwise the union will be lengthy.
P
Parkinbot
Sun, Feb 19, 2017 12:56 AM

Here some example code for inspiration. I used only two polygons. To get a
better and smoother tesselation of the winding plancs (and less problems
with self-intersections), the trajectory should be described with a more
resonable number of polygons.

use
<Naca_sweep.scad>
// http://www.thingiverse.com/thing:900137

start = vec3D(gendat_2D(L=100)); // starting shape
end = Rz_(-70,  // in this specific case better work with negative angle
to avoid self-intersection
Tz_(90,  // translate
vec3D(gendat_2D(L=200))));
trajectory =  [end, start];
sweep(trajectory);  // extrusion, check results with F5/F12, no purple
allowed

// generate 2D shape of N planks to be extruded
function gendat_2D(N = 20, L=100, D=3, d=1, r=1) =
let(l = L/N, one=[[0, d/2], [r/2, d/2], [r, D/2],[l-r/2, D/2], [l,
d/2]])
concat ([for(i=[0:N-1], j=[0:len(one)-1]) [one[j][0]+li, -one[j][1]]],
[for(i=[N-1:-1:0], j=[len(one)-1:-1:0]) [one[j][0]+l
i,
one[j][1]]]);

--
View this message in context: http://forum.openscad.org/alternative-to-hull-tp20461p20481.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Here some example code for inspiration. I used only two polygons. To get a better and smoother tesselation of the winding plancs (and less problems with self-intersections), the trajectory should be described with a more resonable number of polygons. > use > <Naca_sweep.scad> > // http://www.thingiverse.com/thing:900137 > > start = vec3D(gendat_2D(L=100)); // starting shape > end = Rz_(-70, // in this specific case better work with negative angle > to avoid self-intersection > Tz_(90, // translate > vec3D(gendat_2D(L=200)))); > trajectory = [end, start]; > sweep(trajectory); // extrusion, check results with F5/F12, no purple > allowed > > // generate 2D shape of N planks to be extruded > function gendat_2D(N = 20, L=100, D=3, d=1, r=1) = > let(l = L/N, one=[[0, d/2], [r/2, d/2], [r, D/2],[l-r/2, D/2], [l, > d/2]]) > concat ([for(i=[0:N-1], j=[0:len(one)-1]) [one[j][0]+l*i, -one[j][1]]], > [for(i=[N-1:-1:0], j=[len(one)-1:-1:0]) [one[j][0]+l*i, > one[j][1]]]); -- View this message in context: http://forum.openscad.org/alternative-to-hull-tp20461p20481.html Sent from the OpenSCAD mailing list archive at Nabble.com.