Unit Conversion

AutoCAD AutoLISP & Visual LISP

 
Unit Conversion
 
 
 

The acad.unt file defines various conversions between real-world units such as miles to kilometers, Fahrenheit to Celsius, and so on. The function cvunit takes a value expressed in one system of units and returns the equivalent value in another system. The two systems of units are specified by strings containing expressions of units defined in acad.unt.

The cvunit function does not convert incompatible dimensions. For example, it does not convert inches into grams.

The first time cvunit converts to or from a unit during a drawing editor session, it must look up the string that specifies the unit in acad.unt. If your application has many values to convert from one system of units to another, it is more efficient to convert the value 1.0 by a single call to cvunit and then use the returned value as a scale factor in subsequent conversions. This works for all units defined in acad.unt, except temperature scales, which involve an offset as well as a scale factor.