Skip to main content

Working with Units

Units are central to EngCanvas. Every quantity carries dimensional metadata, arithmetic propagates dimensions automatically, and incompatible operations are flagged at evaluation time.

Attaching units to numbers

Place the unit immediately after the number:

L = 20 ft
F = 10 kip
P = 3000 psi
t = 5 sec

EngCanvas recognizes 46 built-in units across eleven categories. Beyond these you can combine any of them into compound units — see Compound units below.

Unit categories

Length

UnitDescription
mMeter (SI base)
ftFoot
inInch
mm, cm, kmMillimeter, centimeter, kilometer
ydYard
miMile
milThousandth of an inch

Force

UnitDescription
NNewton (SI base)
kN, MNKilonewton, meganewton
lb, lbsPound-force
kipKilopound (1000 lb)

Mass

UnitDescription
kgKilogram (SI base)
gmGram
mgMilligram
tonMetric ton (1000 kg)
lb_mPound-mass

Pressure / Stress

UnitDescription
Pa, kPa, MPa, GPaPascal and multiples
psiPounds per square inch
psfPounds per square foot
ksiKips per square inch
ksfKips per square foot

Time

UnitDescription
s, secSecond (SI base)
minMinute
hrHour

Angle

UnitDescription
radRadian (SI base)
degDegree

Temperature

UnitDescription
degKKelvin (SI base)
degCDegree Celsius
degFDegree Fahrenheit
Temperature units are affine

Unlike every other unit, temperatures convert with an offset as well as a scale (degC → K adds 273.15). Write degK, not K — a bare K would shadow common variable names. The offset is applied only at power 1, so degC^2 is treated as a plain multiplicative unit rather than a temperature.

Velocity

UnitDescription
mphMiles per hour
fpsFeet per second

Volume

UnitDescription
LLiter
galUS gallon
buUS bushel

Unit weight (force per volume)

UnitDescription
pcfPounds per cubic foot (lb/ft³)
pciPounds per cubic inch (lb/in³)
kcfKips per cubic foot (kip/ft³)

Other

UnitDescription
gStandard gravity (9.80665 m/s²)

Compound units

Combine units with · (multiplication) and / (division):

stress = 10 kN/m^2       // pressure
moment = 50 kip·ft // force × length
unitWt = 150 lb/ft^3 // unit weight

Add exponents with ^:

I = 500 in^4              // moment of inertia
A = 12 in^2 // area (same as in^2)

How unit arithmetic works

Multiplication

Dimensions add:

F = 10 kip
d = 3 ft
M = F * d // → 30 kip·ft (F·L)

Division

Dimensions subtract:

P = 100 kip
A = 20 in^2
stress = P / A // → 5 ksi (F/L²)

Addition and subtraction

Dimensions must match. These work:

total = 10 ft + 36 in      // → 13 ft (both are length)
net = 50 kip - 10 kip // → 40 kip (both are force)

This raises an error:

bad = 10 ft + 5 kip        // ✗ Dimension mismatch: L ≠ F

Exponentiation

Dimensions scale:

side = 4 ft
area = side^2 // → 16 ft^2 (L²)
volume = side^3 // → 64 ft^3 (L³)

Dimensional analysis (L, M, T, F)

Every unit maps to four fundamental dimensions:

SymbolDimensionSI base unit
LLengthmeter (m)
MMasskilogram (kg)
TTimesecond (s)
FForcenewton (N)

Examples:

QuantityDimensionsExample units
Lengthft, m, in
Areaft^2, m^2
Volumeft^3, m^3
Forcekip, N, lb
PressureF¹·L⁻²psi, kPa, MPa
MomentF¹·L¹kip·ft, N·m
Unit weightF¹·L⁻³pcf, kcf
VelocityL¹·T⁻¹mph, fps
Force vs. Mass

EngCanvas tracks force (F) and mass (M) as independent dimensions. This avoids the confusion between pound-force (lb, F=1) and pound-mass (lb_m, M=1). Use lb for forces and lb_m when you specifically mean mass.

Unit conversion through SI

All calculations happen internally in SI units. The flow is:

  1. Input: 10 ft → convert to SI → 3.048 m
  2. Calculate: all math in SI
  3. Output: convert from SI → display in the unit you wrote

This means you can freely mix unit systems:

total = 1 m + 12 in        // → 1.3048 m (or equivalently, 4.28 ft)

Next steps