Function Entry: CVUNIT

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: CVUNIT

Name

cvunit

Class

Function

Syntax

(cvunit value from-unit to-unit)

Arguments and Values

  • value: integer, real, or list (a 2D / 3D point).
  • from-unit: string naming the source unit.
  • to-unit: string naming the target unit.

Description

Converts value from one unit of measurement to another. Unit names must exist in acad.unt (or acadlt.unt for AutoCAD LT). Returns nil when a unit name is unknown or when the source and target units are incompatible (e.g. grams to years). For repeated conversions of the same unit pair, convert 1.0 once and use the result as a scale factor — except for temperature units, which involve an offset.

Return Values

The converted value as a real (or list of reals if value is a list); nil on failure.

Side Effects

None.

Examples

  • (cvunit 1 "minute" "second") returns 60.0.
  • (cvunit 1.0 "inch" "cm") returns 2.54.
  • (cvunit 1.0 "acre" "sq yard") returns 4840.0.
  • (cvunit '(1.0 2.5) "ft" "in") returns (12.0 30.0).

Availability

  • AutoCAD 2026: documented.
  • BricsCAD V26: presumed compatible.
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.