[OpenSCAD] more sweep() issues

Parkinbot rudolf at parkinbot.com
Fri Jan 5 14:08:34 EST 2018


let me remark some things before giving you advice.
1. your code produces self-intersection. Check this with F12. It will never
pass CGAL
2. I have noticed that current dev snapshots have a bug concerning the use
of rotated polygons as start/end shapes of sweeps. Unavoidable non-planarity
leads to CGAL-errors. https://github.com/openscad/openscad/issues/2246
3. some years ago I have played with the version of sweep you are currently
using, but felt finally that its implicit restriction to using a certain
basic shape is too restrictive for my purposes. Therefore I developed my own
version, which you should know. It expects a vector of polygons placed in 3D
and skins it, just like skin(). 
4. here a simple animation showing a bulb walking through a pipe.
Uncommenting the first call showes, how the polygons are constructed and
placed in 3D space. Uncommenting the second call and enabling animation
(e.g. 10/100) shows the animation of a bubble wandering through a pipe. 

use <Naca_sweep.scad> // https://www.thingiverse.com/thing:900137
w = 40; 

// sweep(trajectory(10), showslices = true); // view polygons as slices
// w = $t*90-10; animated(); 

module animated()
    sweep(trajectory(9, 14)); 

function trajectory(r0 = 10, r1=15, N = 20) =  [for(i=[0:N-1]) 
   let(angle = 90/N*i)
   let(r = max(r0, bulb(r1, 1.9, w-angle)))
   Ry_(angle, Tx_(100, vec3D(circle(r))))];

function circle(r, N=20) = [for(i=[0:N-1]) r*[sin(360/N*i), cos(360/N*i)]]; 
function bulb(r, scale=1, x) =  abs(x)<r?scale*sqrt(r*r-x*x):0; 

Sent from: http://forum.openscad.org/

More information about the Discuss mailing list