Repository navigation
Drawing export A5: dashed lines draw dashed in SVG and PNG (#4890) - #7430
Merged
Merged
Conversation
CamWight
force-pushed
the
paper-dash-4890-a5
branch
from
October 27, 2026 09:53
4063a53 to
1aaff71
Compare
7 of 14 tasks
DevonHope
added a commit
to DevonHope/solidcraft
that referenced
this pull request
Oct 27, 2026
… PNG) Paper scene dashes plus the PNG writer, which includes tangency-labs#7255's grid walk. Stacked on the drawings branch, not on tangency-labs#3891, so it is independent of the storage decision. Conflicts, both from dependency lists: - crates/io/Cargo.toml: kept both sides. Ours adds the cadmpeg FreeCAD/Rhino crates, theirs adds png and tiny-skia for src/paper/png.rs. - Cargo.lock: took ours and let cargo regenerate it, so only the two new io entries are added. cargo xtask licences --check passes: both crates were already in the workspace and in THIRD-PARTY-LICENSES.txt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DevonHope
added a commit
to DevonHope/solidcraft
that referenced
this pull request
Oct 27, 2026
…ll owes Records session 3: tangency-labs#7316, tangency-labs#6482, tangency-labs#7430 and tangency-labs#3891 merged, the owner's decision to follow upstream's in-design storage (so D1 and beta item 6 are superseded), and the regression test for the user_materials cap. New in this file: - BETA-BASE.md: every merged SHA in order, a Phase 1 item. - Section 6.6: the 10 drawing.* commands that owe contracts, and the 20 that predate this work. The coverage test passes (a missing schema is a warning today), and unconverted.txt must not gain lines. - Section 6.7: two integration gaps recorded, not fixed. Part::Model commands are refused while a drawing is open, and a drawing's properties are listed from the design's key table. - Section 8.6: the 3 engine tests that fail on macOS, with the evidence that they are kernel platform divergence rather than these merges, and the list of what a machine with more headroom still owes (wasm, the CLI test, engine clippy, and those three tests on Windows). - Section 5: engine tests always with --lib (building the 10 integration binaries is what crashed the Mac), RAYON_NUM_THREADS, the pgrep self-match that makes a wait loop spin forever, and that PIPESTATUS is empty in zsh. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CamWight
force-pushed
the
paper-dash-4890-a5
branch
from
October 29, 2026 17:06
1aaff71 to
33eaebb
Compare
DevonHope
added a commit
to DevonHope/solidcraft
that referenced
this pull request
Oct 29, 2026
…#4816) `drawing.view.standard` saves the front view, the top and right views projected from it, and an isometric view, at the one preset scale that fits them in the largest band of the drawing border beside the title block. It composes yesterday's `standard_layout` with the records and writers of today's two commits. What stands between this and the phase's done-when is `drawing.sheet.paper` and `drawing.export`, not the SVG writer itself, which tangency-labs#7430 already brought in. It is the first drawing command that reads the model: the scale and the four places follow the part's extents on four planes, so there is nothing to lay out without measuring first. It is therefore not `doc_only()`, and the module's note now separates the four commands that evaluate nothing from this one that does. `StandardLayout` gained `top_side` and `right_side`. The layout already decided them from the drawing's projection, and mirroring that rule in the engine would have been a second place for ISO 5456-2 to live and drift; the geom test asserts them against the projection, so the rule is pinned where it is implemented. Where each view's centre lands is read back from the frame the layout built, with the same `paper_map` the paper scene builder uses, because a projected frame derives the axis it shares with its parent and so is the only thing that knows both coordinates. The two base views carry the fitted scale and the projections carry no style at all, which is how the record spells "follow what you are projected from": a later change to the front view's scale takes its projections with it. Refused rather than guessed: a sheet that already draws views, a sheet with no drawing border, a design with no bodies, a gap outside geom's 0 to 1000 mm, and a sheet too small for four views at any preset scale, which comes back in the layout's own words. `component` is deliberately not a parameter, because the extents are measured over every body the design places and would fit the scale to the wrong ones. The test ties the chain together in both projections: four views at one scale, every centre inside the border and off the built-in title block, the projections on the sides the projection asks (below and left in first angle, above and right in third) and showing the top and right of the part either way. Verified with the machine free: fmt clean, `cargo xtask lists` ok, clippy silent on geom and engine, 309 geom lib tests and the engine tests matching `drawing` pass, among them two strict-mode cases for this contract and an assertion that the four views are one undo step of the drawing which `edit.undo` takes away — this is the only command that is `in_drawing()` without being `doc_only()`, so that step is worth holding down. `hostile_drawing_params_never_panic` now sends hostile values at `gap_mm` too, so `standard_layout` sees NaN, infinity and 1e400 through the command rather than dying at the contract. The engine-wide `hostile_params_never_panic`, deliberately skipped in the last commit while a render had the cores, passes here in 92 seconds — not the ten minutes PROGRESS.md §5 recorded from the laptop, which now says so. `cargo xtask ci` is still not run: free disk is 31 GB against the 60 GB it needs here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CamWight
added a commit
to CamWight/solidcraft
that referenced
this pull request
Oct 30, 2026
…y-labs#5866, W07 V7a) The paper scene gains a kind for views (ObjectKind::View, layer VIEW). drawing_view::paper_group turns a view's lines into its group: each visible piece one stroke, 0.5 mm wide until D2 sets widths by kind of line, closed when it ends where it starts; a line with no length is left out and an arc too short to sweep is its chord. W14 calls it for saved views. drawing.view.snapshot takes scene: true and replies with the lines as a paper scene of its sheet, checked by Scene::validate before it is returned. Hidden lines need dashed strokes (A5, tangency-labs#7430), so scene with visible_hidden is refused until V7b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bherbruck
pushed a commit
that referenced
this pull request
Oct 30, 2026
…5866) (#8970) * View DXF: its lines come from one module both view commands share (#5866, W07 V1) The view DXF (file.export_view_dxf) finds its lines in four files private to the command: the export meshes, the projection, the hidden-line scene and the progress stages. Drawing views (W07's drawing.view) need the same lines, so the four move to engine/src/mesh_lines, with three changes that let a caller other than the DXF use them: - prepare takes the bodies to draw from its caller (the DXF passes the shown ones), and names the caller's command in its errors; - the lines are seen from a View (an origin, a right/up/back basis and, for perspective, the eye's distance) instead of a viewport Camera; the DXF builds one from its camera, with the same arithmetic as before; - a sketch's polyline (Part) belongs to the module, so the sketch code no longer defines what the scene draws. The DXF writing stays in cmd/view_dxf.rs, with connect (the dashed-line joining), and the stage names and cancellation text stay the DXF's. Nothing else changes: the module is the DXF's own code, moved, and the DXF writes the same bytes as before for every case checked (see the PR). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * View DXF: the sketch runs go once the lines are made, and a box's outline pinned (#5866, review) From the review of #6482: - The sketch runs (up to 4,000,000 points) are dropped once the lines are made, as they were before the move, instead of living through the DXF writing. - `mesh_lines::prepare`'s doc says which errors name the command: those about the placements. A body with no exportable surface, the memory budget and cancellation come back as the meshing stage's own. - A new test pins the lines themselves by hand: a plain 40 x 30 x 10 box seen from the front is its 40 x 10 outline. Every line lies along a side, they add up to the 100 mm perimeter, and nothing is hidden. - The shared-geometry test hides the definition's first placement: the other two are still drawn from the one shared mesh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drawing views: the bodies a view shows, worked out once per request (#5866, W07 V3) A view's extents and, next, its lines read one list: each body the design places, with the occurrences that place it and its definition's body name, in the world state's order. Choosing occurrences and hiding parts (V4) and the reference split (V5) become filters on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drawing views: a view's lines from the mesh projection, each named by what drew it (#5866, W07 V3) drawing.view.snapshot now returns its lines: every shown body's edges and silhouettes from the view DXF's mesh projection, seen orthographically on the view's basis, in pieces of one visibility on the sheet. Each line names its occurrence path, its body and its source (an edge, as model.edges numbers it, with whether it is a tangent edge, or a silhouette across a face). They are marked approximate and sampled (Cameron's choice, 2026-10-27): the exact lines (W06) take over per body after the kernel swap (V8). - display_style visible or visible_hidden; tangent_edges hide or show; chord_mm, the paper chord the meshes are asked for (0.001 to 1, 0.01 by default). The model chord is chord_mm over the scale: the view DXF's 1 mm cap doesn't apply, so a view below 1:100 keeps its chord on paper; its 0.0001 mm floor does, and a chord under it is refused with the chord_mm that would do. - max_error_mm is a check, never a setting (the accuracy rule on #5866): refused while any piece is sampled, with the count of pieces short of it. - The three view DXF changes moved here from V1: each segment keeps its owner (its placement and its edge or silhouette face); a stretch two sources share belongs to the nearest visible one, else the nearest hidden one (level ones in owner order), ends where that changes, and counts as covered; the triangles keep their faces for that. The view DXF asks for neither, so it merges and writes as before. (Nearest, not first: a hole seen end on has its bottom rim under its top one, and by owner order the bottom rim took the stretches it shows through, cutting the top rim up.) - A mesh side between two faces every edge between which is drawn is no silhouette: it lies on one of those edges, already drawn from its own curve. (Seen end on, a hole's wall faces neither way, and the side it shares with the top face drew stray chords just inside the rim.) The triangles keep their faces for it in both commands (4 bytes each, in the memory budget); without them the view DXF drew a hole's rim twice, and a view DXF test now finds every line drawn once. - A triangle seen edge on, its normal at most 1e-3 (cosine) toward the view, faces away whatever sign the mesh's own error gives it, so no silhouette lies between two of them. (Seen end on, a bend's surface drew its rows as chords beside its arcs: a 60° bend's outer arc 1.76 times over. A view DXF test now finds each of its arcs drawn once.) - Mesh positions within the tolerance weld: a position takes the key of the first one within it, in its own rounding cell or a neighbouring one. (The faces round a hole's rim are meshed apart, their copies of a rim vertex up to about 1e-7 mm apart, and copies either side of a cell boundary never met: each copy's side was a boundary, drawn as a silhouette.) The view DXF takes these three rules too; they change its lines only where a side lies along a drawn edge, a triangle is seen edge on or a weld was missed. The sample designs' view DXFs lose lines, and each line they gain lies within 0.0011 mm of an old one. - One source's stretches join into runs within twice the tolerance the lines were merged at: the merge drops spans up to that long, so a stretch can stop that short of a corner on either side. - The tangent test is a stadium of cubic segments: the kernel marks a join smooth only between faces swept from cubic segments, and one between two pieces of one surface is a seam, never drawn; a fillet's round keeps its edges, as the viewport draws them. compile fix by the personal PC Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drawing views: a circle facing the view is drawn as its exact arc (#5866, W07 V3) An edge that is a circle, or part of one, in a plane parallel to the view is drawn as its exact arc from Body::planar_edges instead of the mesh's chords. Where the mesh projection says its visibility changes, the arc is cut there: a piece that runs along all of the edge is analytic, a cut piece keeps the mesh's sampled accuracy; its ends may stop within the stretches' join tolerance of the edge's own, as the merge leaves them. planar_edges is asked once per shared mesh and placement turn, for the curved edges only; a part placed again the same way takes the arcs shifted on the view's plane. compile fix by the personal PC Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drawing views: a view's visible lines as a paper scene group (#5866, W07 V7a) The paper scene gains a kind for views (ObjectKind::View, layer VIEW). drawing_view::paper_group turns a view's lines into its group: each visible piece one stroke, 0.5 mm wide until D2 sets widths by kind of line, closed when it ends where it starts; a line with no length is left out and an arc too short to sweep is its chord. W14 calls it for saved views. drawing.view.snapshot takes scene: true and replies with the lines as a paper scene of its sheet, checked by Scene::validate before it is returned. Hidden lines need dashed strokes (A5, #7430), so scene with visible_hidden is refused until V7b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drawing views: a view draws the occurrences its source names and hide leaves out (#5866, W07 V4) drawing.view.snapshot takes source: {occurrences: [[ids]]}, the occurrence subtrees it draws ([] the design's own bodies; every body when not given), and hide: [[ids]], subtrees left out. A body is drawn when its path is under a source path and under no hide path, so a hidden path wins over a source path above it. The rule is one filter on the shown set (ShownSet::keep), so the extents, the lines and the paper scene follow it; each body costs one look-up per head of its path, at most 64. Each path is checked by Session::occurrence_placement as it is (each id in its parent, no id twice, 1 to 64 ids), with at most 1000 paths in each list and 4096 ids in all. [] in hide and a choice that leaves nothing are refused. M2's occurrence tree will make the check one step per id later, inside occurrence_placement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drawing views: a bend seen end on draws its arcs once at any angle (#5866, W07 V4b) A triangle whose surface is seen edge on at each of its corners (the mesh's own normals, at most 1e-3 toward the view) now faces away, whatever lean its facet has. A thin triangle's facet leans by the mesh's chord error over its own width, which can be far past the 1e-3 a facet may lean and still count as edge on. Seen end on, a 90° bend's surface is meshed with its edges' samples at its ends and its rows at even angles inside, 1.667 mm in; the triangles that join the two lean 1.1e-3 to 5.8e-3, so each one facing the view among its neighbours facing away drew silhouettes along its sides: chords beside the arcs, 1.14 times the inner arc and 1.69 times the outer. The view DXF takes the rule too. The export meshes keep their normals for it: 24 bytes a vertex, a position's size again, counted in the export's 512 MB mesh budget, so the largest view that budget takes is about 30% smaller. A mesh without normals keeps its facets' facing. Tests: the bend test takes a 90° bend beside the 60° one; each bend circle's lines add up to its arc, less only what sampling takes off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
CamWight
force-pushed
the
paper-dash-4890-a5
branch
from
October 30, 2026 06:27
33eaebb to
f27322f
Compare
This was referenced Oct 30, 2026
CamWight
force-pushed
the
paper-dash-4890-a5
branch
from
October 30, 2026 16:26
f27322f to
fa8afd0
Compare
CamWight
force-pushed
the
paper-dash-4890-a5
branch
2 times, most recently
from
November 2, 2026 03:05
64ae8b3 to
4b2f1fc
Compare
CamWight
force-pushed
the
paper-dash-4890-a5
branch
from
November 2, 2026 23:34
4b2f1fc to
b1ff542
Compare
CamWight
marked this pull request as ready for review
November 2, 2026 23:36
A stroke can carry a pattern, `Dashes { lengths_mm, phase_mm }`: dash and
gap lengths in turn, in paper millimetres, and how far into the pattern
the stroke starts. Without one a stroke is solid, and a solid stroke
reads and writes as before.
- Checks: 2 to 12 lengths, an even count, each above 0 and at most
1000 mm; the phase from 0 up to the pattern's length; at most a
million dashes along the stroke, counted from its pieces' own lengths.
- The walk puts the pattern on the writer's grid: a dash or gap under
half a step is one step, counted, as widths are.
- SVG: stroke-dasharray, and stroke-dashoffset when the phase isn't 0.
- PNG: tiny-skia's dashing on the flattened line; its points count
against the sheet's, a line in a gap draws nothing, and one tiny-skia
won't cut is refused rather than drawn solid.
- The paper fuzz cases carry a dashed arc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight
force-pushed
the
paper-dash-4890-a5
branch
from
November 3, 2026 11:46
b1ff542 to
25f36be
Compare
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lines on a sheet could only be solid, so hidden lines and centre lines couldn't be told apart from visible edges in an export. Now a line can be dashed, with its own pattern, and the SVG and PNG exports draw it dashed.
Part of #4890 (slice A5 of the paper scene plan, this comment with its one change): dashed lines, in SVG and PNG.
drawingsholds A4 and the walk, so this PR holds only its own commit.Changes a default: no
In
crates/geom:paper.rsgives a stroke a dash pattern, andpaper/grid.rsandpaper/flatten.rscarry it to the writers.paper/annotate.rsanddrawing_sheet.rsname no pattern on their strokes. The rest is tests. These modules hold drawing data only, with no kernel geometry.A stroke without a pattern is solid and reads and writes exactly as before: the field is left out of the JSON when there is no pattern.
What it does
Stroke.pattern: Option<Dashes { lengths_mm, phase_mm }>.Seg2::length: exact for lines and arcs, integrated for curves), as pairs along the length, the way a writer that cuts a line into dashes counts them.GridReport::dashes_snapped). The phase is taken within the rounded pattern. Widths and dashes share one rounding rule (at_least_one).stroke-dasharrayon the stroke's own<path>, andstroke-dashoffsetwhen the phase isn't 0.What the tests can't reach
Zfollows the SVG specification. It isn't checked in a browser.Pictures
One 120 × 80 mm scene, every stroke 0.35 mm wide and dashed 4.2 and 1.05 mm (ISO 128-2's dashed line at d = 0.35 mm): a 100 mm line, a 270° arc and a closed square.
The line ends on the 0.25 mm start of its 20th dash; the square's dashes run round its corners, and both writers put the gaps in the same places.
On this head
25f36be74overdrawingsd78895de4, local, Windows,--profile ci:-D warningsovergeom,ioandengine, all targets, pass;112e0a3d9an hour before:geom's library tests (A5 355, A8a 366, A8b 371, A8c 372) andio's paper tests (34, 34, 34, 38) pass, and on the topxtask lists,xtask layersandxtask wasm. The move tod78895de4changed one engine test line (below);d0550d9c2, overd78895de4:geom's library tests (372),io's paper tests (38) andengine's drawing and paper tests (199 + 2) pass;The planted faults of earlier rounds weren't rerun.
No full gate on this head.
What this rebase changed:
drawingsmoved fromd5fd14135tod78895de4(#10515, #7745, #10516, #11350, #11047, #9708, #11352).Paintstep between the grid's items and its<path>s. HerePaintgoes: fills and text are each one arm, through oneWriter::fill(loops, rule), even-odd for fills and nonzero for text.pattern: None).Tests
patternfield, and unknown fields are refused.15 planted faults, each caught by a test, then a clean run.