Skip to content

Drawings: inspecting a dimension tells where its lines, arrows and text sit on the sheet (#4894) - #16202

Merged
bherbruck merged 2 commits into
tangency-labs:drawingsfrom
CamWight:drawing-dimension-layout-4894
Nov 13, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:drawingsfrom
CamWight:drawing-dimension-layout-4894

Conversation

@CamWight

Copy link
Copy Markdown
Contributor

Change

In a drawing, a dimension is the measurement drawn on the sheet: its extension lines, its dimension line with arrowheads, and its number. Before this PR, an agent or a script could add a dimension but couldn't ask where those parts end up on the sheet. Now drawing.dimension.inspect answers that, and so do drawing.dimension.add and drawing.dimension.repair, because they reply with the same answer. This is part of #4894, the drawings milestone. The dimension editor (#5349) and agent checks such as "does this number overlap that line" are the readers.

This PR sets the shape of a new reply field, layout. Later work for #4894 builds on it, so the shape is open for design review here.

The new layout field gives, in paper millimetres from the sheet's lower-left corner:

  • each extension line and each dimension line, named by its role;
  • each arrowhead;
  • a box with four corners around each text, in reading order.

The layout comes from the same function that draws the dimension on the sheet (paper_group), through the same view frame, moved by the view's centre as the sheet moves it. So the points are the sheet's own numbers, not a second calculation. The sketch layout (DimLayout) now counts the extension lines each kind lays out first, so the lines are named by the layout itself.

When a dimension has no layout, layout_why says why, in the sheet's own words:

  • its view draws its parts apart;
  • its view isn't drawn;
  • there is no place for what it measures;
  • its text waits for a font to fall back to.

Add and its dry run work on the window thread. They now ask for a fallback font and don't wait for the search. While the search runs, the reply has no layout, and layout_why says so. Before this, add could wait on the window thread for the font search.

Inch drawings show the drawing's own inch number: 80 mm reads "3.1496", as display_units gives an inch length.

Changes a default: no

Validation

Local, Windows, --profile ci, on drawings 22b5ce8:

  • cargo fmt --check: clean.
  • cargo check --all-targets of sketch, engine and ui-egui: clean.
  • sketch dims::: 17 passed, 0 failed.
  • The 28 WE7b tests in engine: 28 passed, 0 failed.

Before the rebase onto the newest drawings (same code in WE7b's files):

  • engine drawing_dimension drawing_note_paper drawing_scene schema:: hostile: 987 passed, 0 failed;
  • clippy -D warnings and cargo xtask wasm: clean.

Ten planted faults, each caught by a failing test:

  • the extension-line count;
  • the text box's side and its size;
  • the line roles;
  • a chain's shared extension line kept once;
  • the view-centre move;
  • a move that isn't captured yet;
  • a view that draws its parts apart;
  • no place for what it measures;
  • a text the font can't set.

The tests sit in the area's existing files: dims.rs, drawing_dimension_paper_tests.rs, cmd/drawing_dimension_tests.rs and drawing_scene_tests.rs.

What the tests can't reach:

  • limits that span the whole sheet;
  • a text of several lines in an aligned dimension at an angle;
  • arc-length dimensions on a drawing, because no drawing kind makes one.

Screenshots of the behavior (when observable)

Nothing changes on the sheet: the dimensions draw exactly as before. The change is in the command's reply, so there is no picture.

Integration status

CamWight and others added 2 commits November 13, 2026 15:18
…ines, arrows and text sit on its sheet (tangency-labs#4894)

drawing.dimension.inspect (and so add and repair) answers layout: the
dimension's extension lines, dimension lines, arrowheads and a box for each
text, in paper mm from the sheet's lower-left corner. It is worked out by the
function that draws the dimension, through its view's frame and moved by the
view's centre as the sheet moves it, so the points are the sheet's own. A
dimension with no layout says why in layout_why, in the sheet's words: its
view draws its parts apart, isn't drawn, or has no place for what it
measures. The lines are named by the layout itself: each kind lays out its
extension lines first, and DimLayout now counts them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the inch number (tangency-labs#4894)

drawing.dimension.add, its dry run, inspect and repair lay the
dimension out on its sheet. Add and its dry run run on the window
thread, so the layout now asks for a font to fall back to and doesn't
wait for the search. While the search runs, the reply has no layout and
layout_why says "its text waits for a font to fall back to;
drawing.scene draws it when one is found". A short span's lines depend
on its text's width, so there is no partial layout. Once the sheet has
drawn the text, inspect has the layout. The ask also starts the search
early, so the sheet gets its font sooner.

The units test now expects the drawing's own units: 80 mm in inches
reads "3.1496", as display_units gives an inch length.

Two tests from tangency-labs#12778 assumed the window's read is the first to ask for
a character. Add now asks first, so they give the dimension its text
through drawing.dimension.edit, which lays nothing out. The test helper
settled read the font flag from the extract before its last step, so it
could stop while a step's own read had just left text waiting. It now
reads the answer after each step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions github-actions Bot added the area:sketch sketcher and constraint solver label Nov 13, 2026
@bherbruck
bherbruck merged commit 489843e into tangency-labs:drawings Nov 13, 2026
31 checks passed
@CamWight
CamWight deleted the drawing-dimension-layout-4894 branch November 13, 2026 19:11
CamWight added a commit to CamWight/solidcraft that referenced this pull request Nov 17, 2026
…sit on the sheet (tangency-labs#4894)

`drawing.note.inspect` (and `drawing.note.add`, which answers the same
way) gains `layout`: each leader as drawn, from its arrow's tip through
its elbow to its end, its landing included; each arrowhead's tip and
direction; and its text's box, in paper mm from the sheet's lower-left
corner. A note with no layout says why in `layout_why`, in the sheet's
words. It is the shape `drawing.dimension.inspect` got in tangency-labs#16202.

- `note_group` records its layout as it draws: a leader's points are
  read back from its drawn line, so the landing is the drawn one.
  `LineRole::Leader` names them.
- One rule in one place: `on_its_sheet` (W16-10) now measures on the
  caller's `ViewSessions`, and `ViewSessions::designed` makes the
  designed copy once, so the dimension's inspect, its drag and the note's
  inspect read and lay out on one copy of each view.
  `drawing_scene::on_sheet_layout` is the move to the sheet both layouts
  share (font pending, the alone paper check, plus the view's centre);
  `TEXT_WAITS` moves beside `NOT_DRAWN`. `note_tips` and
  `sheet_note_line_mm` are shared with the sheet's own notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight added a commit to CamWight/solidcraft that referenced this pull request Nov 21, 2026
…sit on the sheet (tangency-labs#4894)

`drawing.note.inspect` (and `drawing.note.add`, which answers the same
way) gains `layout`: each leader as drawn, from its arrow's tip through
its elbow to its end, its landing included; each arrowhead's tip and
direction; and its text's box, in paper mm from the sheet's lower-left
corner. A note with no layout says why in `layout_why`, in the sheet's
words. It is the shape `drawing.dimension.inspect` got in tangency-labs#16202.

- `note_group` records its layout as it draws: a leader's points are
  read back from its drawn line, so the landing is the drawn one.
  `LineRole::Leader` names them.
- The note lays out as the dimension's inspect does: its view through
  `on_its_sheet`, then the dimension's own alone check, now
  `alone_scene` (the font-pending check and the group alone on its
  sheet), which both share. `note_tips` and `sheet_note_line_mm` are
  shared with the sheet's own notes and revision tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight added a commit to CamWight/solidcraft that referenced this pull request Nov 22, 2026
…sit on the sheet (tangency-labs#4894)

`drawing.note.inspect` (and `drawing.note.add`, which answers the same
way) gains `layout`: each leader as drawn, from its arrow's tip through
its elbow to its end, its landing included; each arrowhead's tip and
direction; and its text's box, in paper mm from the sheet's lower-left
corner. A note with no layout says why in `layout_why`, in the sheet's
words. It is the shape `drawing.dimension.inspect` got in tangency-labs#16202.

- `note_group` records its layout as it draws: a leader's points are
  read back from its drawn line, so the landing is the drawn one.
  `LineRole::Leader` names them.
- The note lays out as the dimension's inspect does: its view through
  `on_its_sheet`, then the dimension's own alone check, now
  `alone_scene` (the font-pending check and the group alone on its
  sheet), which both share. `note_tips` and `sheet_note_line_mm` are
  shared with the sheet's own notes and revision tags.
- The text's box comes from `box_centre`, as the sheet's does, so the
  layout follows the note's alignment (tangency-labs#20128). The tests that expect a
  centred note now say `align: centre`, and
  `a_notes_layout_follows_its_alignment` checks left, centre and right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight added a commit to CamWight/solidcraft that referenced this pull request Nov 23, 2026
…sit on the sheet (tangency-labs#4894)

`drawing.note.inspect` (and `drawing.note.add`, which answers the same
way) gains `layout`: each leader as drawn, from its arrow's tip through
its elbow to its end, its landing included; each arrowhead's tip and
direction; and its text's box, in paper mm from the sheet's lower-left
corner. A note with no layout says why in `layout_why`, in the sheet's
words. It is the shape `drawing.dimension.inspect` got in tangency-labs#16202.

- `note_group` records its layout as it draws: a leader's points are
  read back from its drawn line, so the landing is the drawn one.
  `LineRole::Leader` names them.
- The note lays out as the dimension's inspect does: its view through
  `on_its_sheet`, then the dimension's own alone check, now
  `alone_scene` (the font-pending check and the group alone on its
  sheet), which both share. `note_tips` and `sheet_note_line_mm` are
  shared with the sheet's own notes and revision tags.
- The text's box comes from `box_centre`, as the sheet's does, so the
  layout follows the note's alignment (tangency-labs#20128). The tests that expect a
  centred note now say `align: centre`, and
  `a_notes_layout_follows_its_alignment` checks left, centre and right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:sketch sketcher and constraint solver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants