OpenSCAD Ruler

774 views
Skip to first unread message

TeamTeamUSA

unread,
Feb 7, 2010, 4:48:46 AM2/7/10
to MakerBot Operators
Here's a millimeter ruler I made for OpenSCAD. Until OpenSCAD has
built-in rulers, you can you it to measure parts as you design them.
You use it like this:

# translate( [x, y, z] ) rotate( [x, y, z] ) ruler(ruler_length);

The # makes it pink so it's easy to see. You have to position it with
trial and error, but it sure beats printing something out to measure
it.

I put it in a file that I include into all my designs:

</Users/mileslightwood/Documents/MakerBot/Models/lib/myshapes.scad>

/*************************8<*************************************/

module ruler(length)
{
difference()
{
cube( [1, length, 8 ] );
for ( i = [1:length-1] )
{
translate( [0.05, i, 0] ) 1_mm();
if (i % 5 == 0)
{
translate( [0.05, i, 0] ) 5_mm();
}
if (i % 10 == 0)
{
translate( [0.05, i, 0] ) 10_mm();
}
}
}
}

module 1_mm() { cube( [1, 0.125, 3 ] ); }
module 5_mm() { cube( [5, 0.125, 5 ] ); }
module 10_mm() { cube( [10, 0.125, 7 ] ); }

/*************************8<*************************************/

Go!

=ml=

Reply all
Reply to author
Forward
0 new messages