Honor design units in sketch dimensions and measurements (#241)
* Honor design units in sketch dimensions and measurements
* fix: apply document units to specialized length controls
* Accept explicit units in length fields; document design-unit dimension values
Length fields in a design-unit control now evaluate what is typed as a
length expression: a bare number stays in the design's units, while an
explicit unit ("10 mm", "0.5 in", "1 in + 5 mm") is converted.
Document that a bare numeric sketch.dimension value from scripts, the
control channel or MCP is read in the design's units.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT
---------
Co-authored-by: bherbruck <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
23 files changed
+285
-71
No files matched your search
@@ -132,3 +132,16 @@ when a parameter moves the geometry. Islands inside the region are its holes. Wh
|
||||
more than one (both halves of a circle cut by a line), is bounded by exactly those curves, the
|
||||
feature reports an error rather than taking another region. Profiles picked by index or by point
|
||||
(`[{"point": [x, y]}]`) are stored the same way when the feature is made.
|
||||
|
||||
## Measurement units
|
||||
|
||||
Change the current design through **Document Settings > Units** in the browser.
|
||||
The units preference applies to new designs. Existing sketch annotations, live drawing
|
||||
lengths and Measure follow the current design units without resizing geometry.
|
||||
Inches display at least three decimal places and retain a meaningful fourth digit;
|
||||
a higher display precision can be selected in Preferences. Bare length values typed
|
||||
in the dimension tool use the current design units. Explicit units such as `25.4 mm`
|
||||
remain valid in an inch design. Angular dimensions keep their angular units. Deliberately typed four-place inch literals
|
||||
retain trailing zeros. Component/canvas distance controls and inspection, parts-library
|
||||
and flat-pattern measurements follow design units too; parameter expressions and metric
|
||||
standard names retain their explicit authored units.
|
||||
@@ -37,6 +37,12 @@ rolls the numbering back with the design), so they can go straight into later co
|
||||
{"id":8,"method":"engine.execute","params":{"command":"sketch.dimension","params":{"entities":["l1"],"value":50}}}
|
||||
```
|
||||
|
||||
A bare numeric `value` given to `sketch.dimension` (from the control channel, scripts or MCP) is
|
||||
read in the design's units, exactly as if it were typed into the dimension box: in an inch design
|
||||
`"value": 2` makes the line 2 in (50.8 mm) long. Point coordinates stay in millimetres. To pin a
|
||||
unit regardless of the design, pass an expression with one: `"value": "50 mm"` or
|
||||
`"value": "0.5 in"`. Angles are degrees unless the expression says otherwise.
|
||||
|
||||
## UI
|
||||
|
||||
| Method | Params | Notes |
|
||||
|
||||
Reference in new issue
Block a user