The Unit Definition File

AutoCAD AutoLISP & Visual LISP

 
The Unit Definition File
 
 
 

With the AutoCAD unit definition file acad.unt, you can define factors to convert data in one set of units to another set of units. The definitions in acad.unt are in ASCII format and are used by the unit-conversion function cvunit.

You can make new units available by using a text editor to add their definitions to acad.unt. A definition consists of two lines in the file—the unit name and the unit definition. The first line must have an asterisk (*) in the first column, followed by the name of the unit. A unit name can have several abbreviations or alternate spellings, separated by commas. If a unit name has singular and plural forms, you can specify these using the following format:

*[ [common] [ ( [singular.] plural) ] ]...

You can specify multiple expressions (singular and plural). They don't have to be located at the end of the word, and a plural form isn't required. The following are examples of valid unit name definitions:

*inch(es)
*milleni(um.a)
*f(oot.eet) or (foot.feet)

The line following the *unit name line defines the unit as either fundamental or derived.

Fundamental Units

A fundamental unit is an expression in constants. If the line following the *unit name line begins with something other than an equal sign (=), it defines fundamental units. Fundamental units consist of five integers and two real numbers in the following form:

c, e, h, k, m, r1, r2

The five integers correspond to the exponents of these five constants:

c Velocity of light in a vacuum

e Electron charge

h Planck's constant

k Boltzman's constant

m Electron rest mass

As a group, these exponents define the dimensionality of the unit: length, mass, time, volume, and so on.

The first real number (r1) is a multiplier, and the second (r2) is an additive offset (used only for temperature conversions). The fundamental unit definition allows for different spellings of the unit (for example, meter and metre); the case of the unit is ignored. An example of a fundamental unit definition is as follows:

*meter(s),metre(s),m
-1,0,1,0,-1,4.1214856408e11,0

In this example, the constants that make one meter are as follows:

Derived Units

A derived unit is defined in terms of other units. If the line following the *unit name line begins with an equal sign (=), it defines derived units. Valid operators in these definitions are * (multiplication), / (division), + (addition), - (subtraction), and ^ (exponentiation). You can specify a predefined unit by naming it, and you can use abbreviations (if provided). The items in a formula are multiplied together unless some other arithmetic operator is specified. For example, the units database defines the dimensionless multiple and submultiple names, so you can specify a unit such as micro-inches by entering micro inch. The following are examples of derived unit definitions.

; Units of area
*township(s)
=93239571.456 meter^2

The definition of a township is given as 93,239,571.456 square meters.

; Electromagnetic units
*volt(s),v
=watt/ampere

In this example, a volt is defined as a watt divided by an ampere. In the acad.unt, both watts and amperes are defined in terms of fundamental units.

User Comments

To include comments, begin the line with a semicolon. The comment continues to the end of the line.

; This entire line is a comment.

List the acad.unt file itself for more information and examples.