This library has been superseded by revolve2
This OpenSCAD module allows for rotational extrusion of generic user-defined profiles,
introducing a pitch in the longitudinal direction, the most common application being
the creation of screws.
The solid is built as a single polyhedron by transforming the 2D points found in the
profile array. No boolean operation is necessary, aiming at obtaining the ultimate
performance by producing the simplest possible object for the desired level of detail.
revolve( profile, length, nthreads, f);
- profile: array of 2D points defined as [[z1, f(z1)], [z2, f(z2)], ... [zn,f(zn)]].
The function f(z) describes the shape of the thread (trapezoidal, square, triangular,
The shape of the profile can be refined by adding more points, however this will
also make it heavier to handle.
The profile should should be defined over a closed interval (including the extremes)
representing one period of the thread.
The linspace helper function might be used to create the profile from a mathematical
function (see example below).
- length: how far to go in the longitudinal direction, note that the mesh size increases
linearly with this parameter.
- nthreads: allows the creation of multiple threads, it should be an integer.
Negative number are also accepted, generating left threads.
Zero results in no pitch, similar to rotate_extrude.
- f: the number of subdivisions in the angular direction, similar to $fn for a cylinder.
Note that if this parameter is too small, the resulting mesh could be completely wrong.
A sufficient condition to satisfy correctness is: f>period*nthreads/dz;
where dz is the minimum z increment defined in the profile
In the longitudinal direction the number of subdivisions is controlled directly by
the number of points in the profile.
period = 6; // choose the pitch
length = 30; // the tallness
nthreads = 7; // the number of threads (<0 for left threads)
f = undef; // angular finesse, undef for autocompute
// A sinusoidal profile function...
function prof_sin(z) = [z, 10+sin(z*360/period)];
// ...which becomes a profile array with the help of linspace
prof = [for (z=linspace(start=0, stop=period, n=16)) prof_sin(z)];
// A square profile array defined manually
//prof = [
// [0, 11], [0.01, 9], [period/2, 9],
// [period/2+0.01, 11], [period, 11]
// now the screw
revolve( prof, length=length, nthreads=nthreads, f=f);
A limited set of the module capabilities can be previewed in the Customizer.