# [OpenSCAD] Any thoughts on using units other than millimeters?

Bryan Lee leebc11 at acm.org
Sun May 19 20:47:56 EDT 2019

```OHope this is useful to someone.

STLs don't have units.   Per wikipedia:
STL files contain no scale information, and the units are arbitrary.[7]
https://en.wikipedia.org/wiki/STL_(file_format)#cite_note-7

Most of the 3d printing programs I've used have an option to convert from
mm to inches or back, and the CAM program I use (Vcarve) has that as an
option when importing STLs.

I really like the suggestion of surrounding the entire model with a scale(){}
** An advantage of doing this is that you can use larger numbers, and thus
get higher counts in your circle segments (\$FN, etc).   I.e. If you have
something that is 1000 (thou), it will have more segments that something
that's 25.4 (mm).   Not sure I explained that well.

I have been modeling a bunch of furniture lately for a video game.  For
convenience, I've been measuring in inches...because metric tape measures
are hard to find in my town.

All my designes are being built with the measurements as variables, and when I
define the values, I multiply the inches measurement by a scale value,
"inches_to_mm", which is defined as 2.54.

I have been finding, however, that 1 unit in the game world, is
aproximately 1 meter, so I change my scale factor to inch_to_mm=2.54/100;
this was very helpful, and I'm glad I chose to scale everything.

Example code for small table:

inch_to_mm=2.54/100;

top_width=24*inch_to_mm;
top_lenght=42*inch_to_mm;
top_thickness=2*inch_to_mm;
top=[top_width,top_lenght,top_thickness];
leg_length=(29-top_thickness)*inch_to_mm;
leg_width=2*inch_to_mm;

module leg(){		// Other models make more use of this module
cube([leg_width,leg_width,leg_length]);
}

translate([0,0,leg_length])
cube(top);
translate([0,0,0])
leg();
translate([top_width-leg_width, 0, 0])
leg();
translate([0,top_lenght-leg_width,0])   /// far end
leg();
translate([top_width-leg_width,top_lenght-leg_width,0])
leg();

Thus Kevin Toppenberg hast written on Sun, May 19, 2019 at 12:33:43PM -0400, and, according to prophecy, it shall come to pass that:
> I know that OpenScad doesn't formally have units.  But if I make an object:
>
> cube([10,10,10]);
>
> and export it to STL and print it on a 3D printer, it comes out 10x10x10 mm.
>
> Normally I would really like this. But lately I have been making some parts
> as models for things that I will ultimately machine into metal.  And
> because I live in the US, everything here seems to be be in stuck in the
> Imperial system.  So to make an object 1"x1"x1", I do this.
>
> function inch(i) = 25.4*i;
> cube([inch(1), inch(1), inch(1)]);
>
> And while this is perfectly usable, it would be nice if was a switch that
> could change the units from mm to something else.  This means that the
> on-screen scale would need to change also.
>
> E.g.
> \$imperial=1
>
> Has this already been considered?
>
> Thanks
> Kevin T

```