Skip to content

Drawing views: projected views in first or third angle, lined up with their parent (#4816, W17a) - #7611

Closed
CamWight wants to merge 5 commits into
tangency-labs:drawingsfrom
CamWight:views-projected-4816
Closed

CamWight wants to merge 5 commits into
tangency-labs:drawingsfrom
CamWight:views-projected-4816

Conversation

@CamWight

@CamWight CamWight commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Part of #4816 (W17a, drawing views as data), into drawings: its second slice, projected views: the principal views derived from a base view, in first or third angle, lined up with their parent. It builds on the view definitions of #4817, now in drawings. The plan is on #4816.

Changes a default: no

It adds geometry for projected views; no command uses it until the view record (the next PR).

What it does

  • ProjectedSide (left, right, above, below): the side of its parent a projected view sits on.
  • projected_basis(parent, side, projection): in third angle a view shows the side of the model it sits on (one to the right looks from the right); in first angle it shows the side away from it (ISO 5456-2). It's the parent's basis turned a quarter turn about one of its paper axes, through its origin, with no -0. From the front view it gives exactly the named views: right, left, top and bottom in third angle; left, right, bottom and top in first.
  • ViewFrame::aligned(side, projection, centre, position_mm): a projected view at its parent's scale, lined up with it, so it moves only along the free axis.
  • The projection is the title block's cell::Projection (Drawing W18 S2: title blocks as data (#3875) #3877), the value its projection symbol reads, so a drawing has one first-or-third setting.

Tests

  • the front view's projections are the named views in both angles, with no -0;
  • from every named view and a leaning one, a projected view looks from its side and keeps the parent's other axis and origin; four turns, or a turn and its opposite, bring the parent back;
  • a box's corners line up across aligned views in both angles;
  • hostile parents, centres and positions are refused.

Planted faults: 11 of 11 caught, then a clean run. They cover the two angles swapped, a view to the right or below looking from the other side, a view above keeping the wrong axis, -0 kept in the axes, the origin not kept, the parent not checked, a side view not lined up, lining up without the centre, another scale than the parent's, and the sides named otherwise. The code is the same as when they ran.

What the tests don't reach

Corner (isometric) projected views wait for one convention check on first angle. The derivation graph (projected from, lined up with, loops refused) is in the view record, where the view ids live (the next PR).

Validation

  • This commit on drawings ebafe07, with the stack under it: fmt; the geom library tests (276); clippy with all targets on geom, doc, the engine and any other crate it touches; a check of ui-egui, the CLI and the app; and the wasm check (geom, doc, the engine): all pass.
  • The gate (Windows), once on the top of this stack of drawing slices (ab75908, drawings ebafe07 with every slice up to S5's first part): fmt, assets, icons, licences, lists, layers, ui-containers, both clippy runs, wasm and web offline all pass; 6,293 tests passed, 4 failed and 57 ignored, in 76 test binaries. None of the four is from this stack, which changes no file they test: icon_audit's requested_menu_icons_have_artwork_and_match_manifest and xtask's ui_containers test fail on a Windows checkout (fixed on main in ci: fix local scheduling and Windows test baselines #4941 and icon_audit: compare the requested-icons manifest with CRLF checkouts ignored (#4932) #4960); cmd::clearance::tests::a_pin_seated_line_to_line_in_its_bushing_is_measured is on the same PC's known list; and the kernel's boolean_props::commutative failed on a case proptest drew at random (a cylinder against a sphere, where truck refuses a tolerance under 1e-6).

Integration status

Based on drawings ebafe07, on #7610 (P2, a body's extents on a plane), which sits on #3891 and #7490. Until those land, this PR's diff shows them too; its own commit is the last one. No one else's open PR touches crates/geom/src/drawing_view.rs or its tests (checked on 2026-10-27).

Refs #4816, #860

CamWight and others added 5 commits October 27, 2026 04:30
…#3890)

K3b of the drawing storage plan, after tangency-labs#7098: a drawing lives in the file of the design it draws
(bherbruck's proposal, Cameron's choice), so the separate drawing file goes.

- `Document.drawings`: the design's drawings, each its own record of the drawing family
  (`solidcraft-drawing/N`), each behind its own `Arc`. Every reader and writer of a design now
  carries them: save, Save As, autosave and recovery, crash copies, the CLI.
- A design container keeps each drawing in its own entry, `drawings/<id>.json` (Deflate), beside
  `document.json`, which holds nothing of them: its bytes, and the model cache keyed to them, are
  the same with drawings or without. A plain JSON design keeps them inline under `drawings`.
- Each drawing is read by its own family's rules, taken out of the design's JSON before the design's
  own checks. One a build can't read (a newer number, a change it doesn't know, damage) refuses the
  whole design, never dropped. So does an entry under `drawings/` that isn't a drawing's, one whose
  record has another id, drawings inline in a container's `document.json`, two drawings with one
  id, or more than 1,000 (counted before any is read). A design is never saved with two drawings of
  one id.
- Drawings are listed by name, then id: no stored order, nothing to merge when two people add
  drawings.
- A drawing has an `id`, unique among its design's drawings (`Drawing::new` takes the ids already
  taken). Its source is the design it is in: at most one, an id and no path.
- One pending design change, `drawings`: the last release refuses a design saved with it, so it
  never opens one and saves it without its drawings. One pending drawing change, `in-design`, for
  the record's new shape.
- Gone: `read_drawing`, `read_drawing_file`, `write_drawing_container`, `file_kind`, `FileKind`,
  `DRAWING_EXT` and `is_drawing_path`. `read_document`, `read_design` and the container writer are
  as they were before tangency-labs#7098, with the drawings added.

Tests: a design's drawings round-trip through both forms byte for byte, with `document.json` and
`container.json` the same with drawings or without; their order; every refusal above; a drawing's
properties kept as other tools wrote them while a sheet's number out of range is refused; the
drawing's id among its objects', a new drawing's id none of the design's; a design with two
drawings of one id not saved; mutation fuzz of a design with drawings in both forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndo (tangency-labs#3890)

K4' of the drawing storage plan, on K3b (a drawing lives in its design's file): make, list, open,
close and delete a design's drawings, and read and change the open one's settings and properties.
It replaces tangency-labs#3891's drawing sessions, which held a drawing as a file of its own.

- `drawing.create {name?, language?, units?}` adds a drawing of the design (one ISO A3 landscape
  sheet with the ISO border, the design its one source) and opens it; refused on an empty design.
  `drawing.list`, `drawing.open {drawing}`, `drawing.close`, `drawing.delete {drawing}`.
  `drawing.inspect`, `drawing.set`, `drawing.properties`, `.properties.set`, `.properties.remove`
  work on the open drawing. Labels in en, ja and zh.
- The open drawing is the session's (`Session::open_drawing`, kept in checkpoints), and the part
  gate keeps the parts apart: a command says the part it works on, the model unless it says
  otherwise (`.in_drawing()`, `.any_part()`). While a drawing is open the model's commands wait
  ("a drawing is open: close it to change the model"); the drawing's run only while one is.
  Files, recovery, undo and redo, checkpoints, selection, diagnostics, the command list and
  choosing a drawing work either way. `CommandSpec::allowed` is the one check running a command,
  running it inside another and listing it make.
- `Session::drawing` and `Session::edit_drawing` are the open drawing's one way in: an edit is kept
  when it changed something and still keeps the record's rules, in a new design whose other
  drawings are shared.
- A change that only touches drawings evaluates nothing: `Document::differs_only_in_drawings`
  joins the render-only path, as render settings and part properties do. A model edit shares
  every drawing, so it pays nothing for the check.
- Undo per part: a step records the part it changed (`Snapshot::part`: a drawing, or the model
  and its list of drawings). Undo and redo go through the open part's steps only. A drawing's
  step puts back only that drawing; the model's step puts back the design as it was, keeping each
  drawing it had as it is now. Making and deleting a drawing are the model's steps. A new step
  ends what could be redone in its own part only. `Snapshot::of` is the one place a step is
  taken.
- An agent's message that changed several parts keeps their steps apart, rather than merging them
  into one step that would undo only one part.
- `cmd::metadata`'s rules for reading, setting and removing properties are written once
  (`reading`, `setting`, `removing`) and used by the design's and the drawing's commands.
- `drawing::sort` is the one place the drawings' order (by name, then id) is kept;
  `Document::put_drawing` adds or replaces one in that order.

Tests: making, listing, opening, closing and deleting; what making one refuses, at the cap too; the
gate both ways, inside another command and in the command list; drawing edits as undo steps that
evaluate nothing over 100 rounds; undo and redo per part with model and drawing steps interleaved;
redo ended per part; the order by name, then id, after renames; delete and its undo; refused
changes; checkpoints; save and open in both forms; properties; hostile values for every command
that runs with a drawing open, from the registry; a fuzz of the steps in any order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawing.open now joins doc.open in the suggestion for `file.open`, as the rule says: both end in
the same word. The engine's and the CLI's tests check that doc.open comes first and let other
close ids follow, as the `solid.extrud` line beside them already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tangency-labs#5866)

ModelBody::mesh_bounds_in(plane) is the box of a body's mesh in a plane's own coordinates
(Plane::to_local), beside mesh_bounds and in the same way: a body meshed already is measured from
its own mesh, and a placement of a part from its definition's shared mesh, with the placement
folded into the plane's two axes once (two dot products a point), so no moved copy is made. W07's drawing.view measures a view's extents with it.

Tests: a 100 x 50 x 20 block seen on the three principal pairs of axes and from an isometric
corner (150/sqrt(2) by 190/sqrt(6), worked by hand), a plane away from the origin, and every
placement in the shared-mesh test against its moved mesh, still without a moved copy, and the
same again from its own mesh once it is meshed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… their parent (tangency-labs#4816, W17a)

W17a's second slice: the principal views derived from a base view.

- `ProjectedSide` (left, right, above, below): the side of its parent a
  projected view sits on.
- `projected_basis(parent, side, projection)`: in third angle a view shows
  the side of the model it sits on (one to the right looks from the right), in
  first angle the side away from it (ISO 5456-2). It's the parent's basis
  turned a quarter turn about one of its paper axes, through its origin, with
  no -0. From the front view it gives exactly the named views: right, left, top
  and bottom in third angle; left, right, bottom and top in first.
- `ViewFrame::aligned(side, projection, centre, position_mm)`: a projected
  view at its parent's scale, lined up with it, so it moves only along the free
  axis.
- The projection is S2's `cell::Projection`, the value the title block's
  symbol reads, so a drawing has one first-or-third setting.

Tests: the front view's projections are the named views in both angles, with
no -0; from every named view and a leaning one, a projected view looks from
its side and keeps the parent's other axis and origin, four turns or a turn
and its opposite bring the parent back; a box's corners line up across
aligned views in both angles; hostile parents, centres and positions refused.

Corner (isometric) projected views wait for one convention check on first
angle. The derivation graph (projected from, aligned to, cycles refused) moves
to the view record in the drawing file, where the view ids live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added area:doc timeline, components, parameters, naming area:infra CI, tooling, repo, docs area:io import/export and file formats (STEP, IGES, 3MF, glTF, designs) area:kernel B-rep kernel, booleans, blends, STEP/IGES area:ui desktop/web front end, dialogs, viewport labels Oct 27, 2026
@CamWight
CamWight marked this pull request as ready for review October 27, 2026 20:40
@CamWight

Copy link
Copy Markdown
Contributor Author

Closing: all of this PR's changes are in drawings now. They went in with #8959 (squash commit a09c24e), which carried this PR's commits. Thank you!

@CamWight CamWight closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doc timeline, components, parameters, naming area:infra CI, tooling, repo, docs area:io import/export and file formats (STEP, IGES, 3MF, glTF, designs) area:kernel B-rep kernel, booleans, blends, STEP/IGES area:ui desktop/web front end, dialogs, viewport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant