Figure of Revolution Generator by fizzup 3d model
3dmdb logo
Thingiverse
Figure of Revolution Generator by fizzup

Figure of Revolution Generator by fizzup

by Thingiverse
Last crawled date: 3 years ago
This is a perl script that generates a solid figure of revolution, which is equivalent to a solid figure with a top surface that conforms to a single-valued function of r in cylindrical coordinates - z = f(r).
The example STL is a normalized sinc function, z(r) = sin(π•r)/π•r, but z(0)=1 over the range r:[0,5] and scaled 5:1 in mm. To get this shape:
RevolutionFigure.pl z='sub{ my ($r) = @_; $r *= atan2(1,1)*4.0; return $r==0 ? 1 : sin($r)/$r; }' r=0,5 base=0.35 e=0.005 scale=5 file=sinc.stl
The clever part of the script is that you can specify the function that you want to print by using the "z=" parameter and writing a perl lambda function for the script to draw. Ha!
Script Parameters
z is the function that you want to draw. The skeleton looks like this z='sub{ my ($r)=@_; return ; }' You may have to use double quotes to make it work in Windows.
r is the range of r to use in order to compute z. Make sure that z is defined in real numbers over the whole range of r, or the script will error out.
base is the minimum thickness of the figure. If you make this zero, then the figure should either be at a minimum at one end of the r range or the other, or else you will get a print that is split at any place where z is at a minimum.
e is the maximum allowable error between the print surface (after scaling) and the true surface. Expressed in mm. The smaller this parameter, the more triangles the script will draw. You can wind up with a mondo STL file if you're not careful.
scale is the scale factor, so scale mm represents a unit in r or z.
file is the file to write as STL.
b is an optional lambda function that describes the bottom. If you specify b then the base parameter is ignored. This can be useful for strictly positive z functions where you want to have the base at zero, i.e., b = 'sub{ 0; }'. If your base function is anything other than a plane, you are probably going to need to print with support.
It is possible (but a pain) to use b to print a shell rather than a solid.

Tags