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
| Unit | Description |
|---|---|
m | Meter (SI base) |
ft | Foot |
in | Inch |
mm, cm, km | Millimeter, centimeter, kilometer |
yd | Yard |
mi | Mile |
mil | Thousandth of an inch |
Force
| Unit | Description |
|---|---|
N | Newton (SI base) |
kN, MN | Kilonewton, meganewton |
lb, lbs | Pound-force |
kip | Kilopound (1000 lb) |
Mass
| Unit | Description |
|---|---|
kg | Kilogram (SI base) |
gm | Gram |
mg | Milligram |
ton | Metric ton (1000 kg) |
lb_m | Pound-mass |
Pressure / Stress
| Unit | Description |
|---|---|
Pa, kPa, MPa, GPa | Pascal and multiples |
psi | Pounds per square inch |
psf | Pounds per square foot |
ksi | Kips per square inch |
ksf | Kips per square foot |
Time
| Unit | Description |
|---|---|
s, sec | Second (SI base) |
min | Minute |
hr | Hour |
Angle
| Unit | Description |
|---|---|
rad | Radian (SI base) |
deg | Degree |
Temperature
| Unit | Description |
|---|---|
degK | Kelvin (SI base) |
degC | Degree Celsius |
degF | Degree Fahrenheit |
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
| Unit | Description |
|---|---|
mph | Miles per hour |
fps | Feet per second |
Volume
| Unit | Description |
|---|---|
L | Liter |
gal | US gallon |
bu | US bushel |
Unit weight (force per volume)
| Unit | Description |
|---|---|
pcf | Pounds per cubic foot (lb/ft³) |
pci | Pounds per cubic inch (lb/in³) |
kcf | Kips per cubic foot (kip/ft³) |
Other
| Unit | Description |
|---|---|
g | Standard 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:
| Symbol | Dimension | SI base unit |
|---|---|---|
| L | Length | meter (m) |
| M | Mass | kilogram (kg) |
| T | Time | second (s) |
| F | Force | newton (N) |
Examples:
| Quantity | Dimensions | Example units |
|---|---|---|
| Length | L¹ | ft, m, in |
| Area | L² | ft^2, m^2 |
| Volume | L³ | ft^3, m^3 |
| Force | F¹ | kip, N, lb |
| Pressure | F¹·L⁻² | psi, kPa, MPa |
| Moment | F¹·L¹ | kip·ft, N·m |
| Unit weight | F¹·L⁻³ | pcf, kcf |
| Velocity | L¹·T⁻¹ | mph, fps |
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:
- Input:
10 ft→ convert to SI →3.048 m - Calculate: all math in SI
- 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
- Unit System (deep dive) — dimensional analysis internals
- Operators — how operators interact with units