screw extrusion lib for polyhedron by FaberUnserzeit 3d model
3dmdb logo
Thingiverse
screw extrusion lib for polyhedron by FaberUnserzeit

screw extrusion lib for polyhedron by FaberUnserzeit

by Thingiverse
Last crawled date: 3 years ago
When it comes to threads, most people's approach is a for()-loop with many segments, that consist of hull(){shape(n); shape(n+1)} or a set of simple polyhedrons. This takes long to render and has it's restrictions due to the early passing of work to openSCAD.
As an alternative to that I have written the function screw_extrude_v(), that returns the required parameters for polyhedron().
Besides the standard-parameters for such functionality it receives a vector with the points of a a polygon, that makes the shape of the thread, and calculates and returns both vectors and a roughly calculated convexity required for polyhedron() for further processing. Primary target for modifications is the first parameter “points“, while the second parameter “faces“, which describes how to turn the points to a surface, is seldom something to change, though changes should be possible here, too, for example to slice an object and combine the rest with another object in the same format.
The most simple form to use it is this:
v = screw_extrude_v(P, r, p, d, sr, er, fn, rf);
polyhedron(v[0], v[1], convexity = v[2]);
for a thread with constant diameter
or
v = screw_extrude_v(P, r1, r2, p, d, sr, er, fn, rf);
polyhedron(v[0], v[1], convexity = v[2]);
for a thread with growing/shrinking diameter, like for US-garden tubes or tightening threads on ball-joints.
Another notable feature is the sr (starting ramp) and er (ending ramp) parameters, that, giving an angle, make a soft start and end of the thread, without the need to cut it's end off with difference(), which still doesn't give a proper easily gripping thread-ending.
The parameter rf (ramp form) determines the shape of the ending. It's a string with one of the values "lin" (linear, default), "sin" (soft start, no corner between thread an ramp, steep end), and "sin2" (soft start and end of ramp).

Tags