Var
类型: 类
领域: 表达式、单位与公差
推荐导入: from cadflow import Var
签名
class Var(name: 'str', default: 'float', comment: 'str | None' = None, expr_id: 'str' = <factory>, tolerance: 'DimensionTolerance | None' = None, unit: 'Unit | None' = None, tolerance_unit: 'Unit | None' = None) -> None
功能说明
Var 是 CadFlow 表达式、单位与公差领域的公共类。
原始 API 说明
Named scalar parameter with optional physical-unit and tolerance intent.
default and tolerance remain in their declared units. Evaluation, geometry parameters, and tolerance propagation convert them to CadFlow's canonical CAD units: millimeters for length and degrees for angle.
参数
| 名称 | 类型 | 必需 | 默认值 | 源码说明 |
|---|---|---|---|---|
name | 'str' | 是 | - | 源码 Docstring 未单独说明。 |
default | 'float' | 是 | - | 源码 Docstring 未单独说明。 |
comment | 'str | None' | 否 | None | 源码 Docstring 未单独说明。 |
expr_id | 'str' | 否 | <factory> | 源码 Docstring 未单独说明。 |
tolerance | 'DimensionTolerance | None' | 否 | None | 源码 Docstring 未单独说明。 |
unit | 'Unit | None' | 否 | None | 源码 Docstring 未单独说明。 |
tolerance_unit | 'Unit | None' | 否 | None | 源码 Docstring 未单独说明。 |
返回值
类型: None
源码 Docstring 未声明更多返回语义。
异常
源码 Docstring 未声明更窄的异常契约。类型、数值、所有权、路径或后端状态无效时,仍可能抛出相应公共异常。
数据字段
| 名称 | 类型 | 默认值 |
|---|---|---|
name | 'str' | required |
default | 'float' | required |
comment | 'str | None' | None |
expr_id | 'str' | factory |
tolerance | 'DimensionTolerance | None' | None |
unit | 'Unit | None' | None |
tolerance_unit | 'Unit | None' | None |
公共成员
| 成员 | 类型 | 签名 | 说明 |
|---|---|---|---|
canonical_default | property | - | 见成员签名。 |
canonical_tolerance | property | - | 见成员签名。 |
dimension | property | - | 见成员签名。 |
evaluate | method | (self, bindings: 'Mapping[str, float] | None' = None) -> 'float' | 见成员签名。 |
行为与约束
- 实例是不可变 dataclass 值;更新式工作流会返回替代值。
导入检查
from cadflow import Var