# APREPRO Units

Trelis uses a unitless coordinate system. For example, the command brick x 10 creates a cube 10 units wide, but Trelis does not know whether those 10 units are 10 inches, 10 meters, 10 microns or 10 miles. The Aprepro Units() function facilitates the use of a unit system in Trelis' unitless environment.

The Aprepro Units(svar) function takes a single string parameter which identifies the desired unit system. If the specified unit system is recognized, then a set of variables are defined to facilitate working in that unit system. Dimensions can be multiplied by an appropriate unit variable to convert between various dimensions. For example, the statement #{Units("in-lbf-s")} defines variables useful when working in a coordinate system where one Trelis unit is one inch. The command brick x {1*ft} will create a cube 12 units wide, and the command brick x {1*m} will create a cube 39.37 units wide, the number of inches in 1 meter.

It is important to note that the Units() function does nothing more than define a set of useful variables. The function does not change the dimensions of existing geometry, nor does it change the scale of geometry imported from a file. For example, the following commands create two cubes, the first being 12 units wide and the second being 1 unit wide. The first cube remains 12 units wide, even after the second call to the Units() function:

#{Units("in-lbf-s")}
brick x 1*ft
#{Units("ft-lbf-s")}
brick x 1*ft

The Units() function returns a zero-length string if it is successful. If the Units() function fails (usually because the specified unit system was not recognized), a non-zero-length string containing an error message is returned.

The unit systems currently supported by the Units() function are: si, cgs, cgs-ev, shock, swap, ft-lbf-s, ft-lbm-s, in-lbf-s. For each of these unit systems, the following variables are defined by the Units() function:

Table 1. String Variables

 Name Value Tout Base Time Unit lout Base Length Unit Aout Base Acceleration Unit Mout Base Mass Unit fout Base Force Unit vout Base Velocity Unit Vout Base Volume Unit dout Base Density Unit eout Base Energy Unit Pout Base Power Unit pout Base Pressure Unit Tout Base Temperature Unit Aout Base Angle Unit

Time Variables

• sec
• second
• usec
• microsecond
• msec
• millisecond
• minute
• hr
• hour
• day
• yr
• year
• century

Length Variables

• m
• meter
• metre
• cm
• centimeter
• centimetre
• mm
• millimeter
• millimetre
• um
• micrometer
• micrometre
• km
• kilometer
• kilometre
• ft
• foot
• mi
• mile
• yd
• yard
• in
• inch
• mil

Acceleration Variables

• ga

Force Variables

• newton
• N
• dyne
• lbf
• kip
• kgf
• gf
• pdl
• poundal
• ounce

Mass Variables

• kg
• gram
• g
• lbm
• slug
• lbfs2pin

Velocity Variables

• mps
• fps
• mph
• ips
• kph
• kps

Volume Variables

• liter
• gal
• gallon

Density Variables

• gpcc
• kgpm3
• lbfs2pin4
• lbmpin3
• lbmpft3
• slugpft3

Power Variables

• W
• watt
• Hp

Energy Variables

• joule
• J
• ftlbf
• Btu
• erg
• calorie
• kwh
• therm
• tonTNT

Pressure Variables

• Pa
• pascal
• MPa
• GPa
• bar
• kbar
• Mbar
• psi
• ksi
• psf
• atm
• torr
• mHg
• mmHg
• inHg
• inH2O
• ftH20

Temperature Variables

• degK
• kelvin
• degC
• degF
• degR
• rankine
• eV

Angular Variables