Loading

OpenSCAD ruler

by jbrown123, published

OpenSCAD ruler by jbrown123 Sep 19, 2012

Contents

License

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

9113Views 1834Downloads Found in 3D Printing

Summary

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!

Instructions

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.

Usage:
use <ruler.scad>
%ruler(length = 150, t=[0,0,0], r=[0,0,0])

  1. length is the length of the ruler
  2. t is the transform to be applied so you can move the ruler away from the origin if necessary
  3. r is the rotation to be applied so you can put the ruler somewhere other than along the Y axis.

Examples:

  1. cube(30); use <ruler.scad> %xyzruler(32);
  2. import("some.stl"); use <ruler.scad> %ruler(length=30, t=[-15,-15,0], r=[0,0,-45]

More from 3D Printing

view more

All Apps

Upgrade this Thing with Thingiverse Apps


No results.

Thanks. It works in version 2015.05.04.

Write.scad requires orbitron.dxf file.
font="orbitron.dxf" code in ruler.scad instead font="write/orbitron.dxf" removes compile error.

This is very useful. One suggestion (and this may just be my personal preference). To me, you should do the translate AFTER the rotate so that you rotate the ruler the way you want and then you move it in the X,Y,Z directions naturally. The way it is now, you have to think about how to translate it and then rotate it.

So the code changes to:

translate(t) rotate(r)  union()

What do you think?

Top