|
||||||||||||||||||||||||||||||
|
AutoCAD Tips & TutorialsSwitch between Imperial and metric measurementsIf 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 /) 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 /) 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 routinesTo 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: 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.
|
|
|
|||||||||||||||||||||||||||
Home | AutoCAD | PowerPoint | E-Store
| About | Links | Contact | Site Map
|
||||||||||||||||||||||||||||||