A ruler for OpenSCAD so you can tell how big things are. Especially helpful when importing an STL or working with complex shapes.
Many thanks to HarlanDMii for his fabulous write library!
You can import this into any OpenSCAD file to add one or more rulers to your object. This thing requires the write library from HarlanDMii (thing 16193, http://www.thingiverse.com/thing:16193). I have mine in a subdirectory named, creatively, 'write'. If your copy of write is somewhere else, you will need to change both the 'use' statement (line 3) and the font parameter of the write command (line 18) to match your path.
The main routine is 'ruler' and it defaults to reasonable parameters. The default length is 150mm which is the (approximate) size of the Solidoodle print platform. The default position is starting at the origin and extending along the Y axis. You can change all this using parameters to the ruler module (see below).
There are also some convenience routines: xruler(length=150), yruler(length=150), zruler(length=150), and xyzruler(length=150), each of which does what you would expect; they place a ruler starting at the origin along the specified axis. In the case of xyzruler, it puts a ruler along each axis.
I suggest using the OpenSCAD Background Modifier '%' (see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Modifier_Characters) to show the ruler without including it in your actual object. This will cause the ruler to appear as a 'ghost' image but it will not effect your object at all.
%ruler(length = 150, t=[0,0,0], r=[0,0,0])
- length is the length of the ruler
- t is the transform to be applied so you can move the ruler away from the origin if necessary
- r is the rotation to be applied so you can put the ruler somewhere other than along the Y axis.
- cube(30); use <ruler.scad> %xyzruler(32);
- import("some.stl"); use <ruler.scad> %ruler(length=30, t=[-15,-15,0], r=[0,0,-45]