Files
make-cad/docs/skill/references/docs/api/var_function.md
T
NiJingzhe 152bbf3432 refactor!: reorganize package root into themed subpackages
- operators/: _support + geometry/features/boolean/transform/selection/sketch/product
- product/: semantic value model, solver, occurrence, packages, capture
- topology/: model, tagging, tracking, autotag (package re-exports model symbols)
- params/: units, expr, tolerance, frame
- recording/: graph, serializer, source_mapping
- _internal/: canonical_json, vendor_warning_filters, semantic, mesh, brep_region

Root shrinks from 46 to 7 modules. Drop the legacy geometry/boolean/transform/
selection monolith copies and the operations.py facade; unified operator
exports now live in operators/__init__ with monkeypatch mirroring preserved.
Remove the legacy evolve generators and their example/tests/docs. Import paths
for simplecadapi.topology keep working via package re-export; update all
in-repo consumers, tests, tools/auto_docs_gen source tables, and regenerate
the skill API reference docs.
2026-08-31 12:46:57 +08:00

880 B

var

API Definition

def var(name: str, default: int | float, comment: str | None = None, tolerance: ToleranceLike | None = None, *, unit: UnitLike | None = None, tolerance_unit: UnitLike | None = None) -> Var

Source: params/expr.py

Import Surface

  • top-level: from simplecadapi import var

Description

Create a physical or legacy scalar variable.

tolerance=0.1 declares a symmetric +/-0.1 tolerance. Use a (lower_deviation, upper_deviation) pair for an asymmetric tolerance. tolerance_unit defaults to unit when a nominal unit is declared. Values are converted to canonical CAD units only when evaluated, so the declaration and serialized expression node preserve the user's units.

Variables without unit retain legacy unitless behavior. A unit-aware expression cannot mix declared-unit variables with legacy variables.