If you usually draw using Imperial measurements (feet and inches), you may sometimes want to enter a length in metric units. For example, if you’re designing a house in the United States, you may have certain items that were imported from Europe and are measured in millimeters or centimeters. It might be easier to be able to enter the metric measurements but calculating the conversion can be time-consuming.
Of course, the opposite is possible. If you are drawing using metric measurements, you may need to enter a length in Imperial units. Here are a couple of AutoLISP programs, one that converts Imperial to metric (inches to millimeters) and one that converts metric to Imperial (millimeters to inches). You can use these routines whenever you need to enter a length, generally with the LINE command.
You can change these routines to make other conversions, of course.
Convert metric to Imperial
(defun m2i (len ang /)
(strcat “@” (rtos (* len (/ 0.03937 1))) “<” (rtos ang))
)
This routine (m2i means metric to Imperial) multiplies any length by 0.03937 because there are 0.03937 inches in a millimeter. So if you use a length of 100 millimeters, you’ll get 3.937 inches.
Convert Imperial to metric
(defun i2m (len ang /)
(strcat “@” (rtos (* len (/ 25.4 1))) “<” (rtos ang))
)
This routine (i2m means Imperial to metric) multiplies any length by 25.4, because there are 25.4 millimeters in an inch. So if you use a length of 3 inches, you’ll get 76.2.
How to use these routines
To load these routines, you can put them in acaddoc.lsp (which you may need to create). Make sure acaddoc.lsp is in your support file search path. Any routines in this file are automatically loaded each time you open a new drawing.
These routines have two parameters, len (length) and ang (angle). You use them at the Specify next point or [Undo]: prompt, in parentheses, adding the length and angle that you want for the line segment, as shown in this example:
(m2i 25 0)
Immediately afterwards, you see the results of the routine, so you can check that you’re getting the result you want, as shown here:
“@0.9843<0.0000”
So you’re command line would look like this:
Command: _line Specify first point:
Specify next point or [Undo]: (m2i 25 0)
“@0.9843<0.0000”
Specify next point or [Undo]:
You can then continue to specify other line segments.
I want to thank Darren Young (www.mcwi.com) for the original AutoLISP code, which I’ve changed slightly, and expanded upon.
- Combine or subtract 2D shapes to create custom shapes - February 17, 2022
- Working with linetype scales - January 18, 2022
- Rename named objects–blocks, dimension styles, layers, and more - December 21, 2021
This works good for a single distance at an angle but how would you use this in a rectangle command when there is an x y move and te angle is not known?
I’m doing something wrong. I loaded each lisp routine and the the commands showed in the command window when loaded (i.e. i2m and m2i). I started the line command and picked a 1st point. Next I entered for example (m2i 50 0) and got the error “bad argument type: stringp nil”. Same result with the “i2m”. Just curious what went wrong.
how can i craeate acaddoc.lisp
while entering units are in meter, but i need in mm pls suggest
Not sure what you mean…
krmchari, scale entire drawing 1000 times to convert meters to mm
I wanted to know how to get the start up menu for autocad to come back on so i can choose to use either metric or imperial. I believe its called start from scratch, I wanted to know if there’s a way to get this menu to come up every time i start autocad. I have 2012.
Try setting the STARTUP system variable to 1
Yeah some how it is useful for the measurements when you need conversions then it help to make accurate measurements.Thanks for sharing this useful and informative conversion.
With ortho turned on, enter the line command, pick your first point, enter (cal) or ‘cal(you must include the apostrophe). If you want a 5mm length line enter 5/25.4. Example: L;pickpoint;’cal;5/25.4;
we are using 230mm is 9″ or 6″ is 150mm for work.
because 230mm is Exactly 9.055118 and 6″ is Exactly 152.4003mm
so drawing is not 100% right. and if we relese this type of drawing
some error are came on site..
any suggestion for this..
sorry for my bad english.