Skip to main content

Unit

Kind: Class
Domain: Expressions, units, and tolerances
Canonical import: from cadflow import Unit

Signature

class Unit(symbol: 'str', dimension: 'Dimension', scale_to_canonical: 'float') -> None

Description

Named unit with a scale to CadFlow's canonical numeric units.

Named unit with a scale to CadFlow's canonical numeric units.

Custom units are supported and serialize their symbol, dimension, and scale. Registered built-in units serialize as compact symbols.

Parameters

NameTypeRequiredDefaultSource description
symbol'str'yes-Not explicitly described in the source docstring.
dimension'Dimension'yes-Not explicitly described in the source docstring.
scale_to_canonical'float'yes-Not explicitly described in the source docstring.

Returns

Type: None

The source docstring does not declare additional return semantics.

Errors

The source docstring does not declare a narrower exception contract. Invalid types, values, ownership, paths, or backend state may still raise the corresponding public error.

Data fields

NameTypeDefault
symbol'str'required
dimension'Dimension'required
scale_to_canonical'float'required

Public members

MemberKindSignatureDescription
from_canonicalmethod(self, value: 'int | float') -> 'float'See the member signature.
from_dictclass method(cls, data: 'Mapping[str, Any]') -> "'Unit'"Rebuild a custom unit from its serialized definition.
to_canonicalmethod(self, value: 'int | float') -> 'float'See the member signature.
to_dictmethod(self) -> 'Dict[str, Any]'See the member signature.

Behavior and constraints

  • Instances are immutable dataclass values; update workflows return a replacement value.

Import check

from cadflow import Unit

See also