Skip to main content

unit()

Declares the length unit of the file it is written in. Numbers in the file are then in that unit; the default is millimetres. Must be the first statement after the imports (top level, before any geometry, once per file, literal string) and is only allowed in part files — assemblies use the project unit from fluidcad.json.

tip

See the guide for detailed usage examples.

Signatures

unit(name: string): void

Declares the length unit of the file it is written in. Numbers in the file are then in that unit; the default is millimetres. Must be the first statement after the imports (top level, before any geometry, once per file, literal string) and is only allowed in part files — assemblies use the project unit from fluidcad.json.

ParameterTypeDescription
namestringOne of 'mm', 'cm', 'm', 'in', 'ft'. Aliases such as 'inch', 'inches', 'millimeter' or 'feet' are accepted.