Skip to content

Drawings: views draw tapped holes and threaded shafts with standard thread lines - #13051

Merged
bherbruck merged 2 commits into
tangency-labs:drawingsfrom
CamWight:drawings-thread-13050
Nov 16, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:drawingsfrom
CamWight:drawings-thread-13050

Conversation

@CamWight

@CamWight CamWight commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Cam

Change

SolidCraft's drawings now show a part's threads the way drafting standards draw them. Before this PR, a tapped hole or a threaded shaft looked plain in a drawing view, the same as an unthreaded one. Part of #13050 (part of #860).

A view now draws each cosmetic thread by the ISO 6410 convention:

  • Seen end on: the crest circle the view already draws, plus the root as a thin three-quarter arc, with its gap in the upper right quarter. On a tapped hole the arc is outside the drilled circle. On a screw the arc is inside.
  • Seen from the side: thin root lines along the threaded length, and a limit line across the thread where it ends.
  • Hidden threads take the hidden style with the rest of the hidden lines. A thread inside a block is dashed in a view with hidden lines.
  • Seen at a slant: no thread lines, as the standard says.

Each thread line takes its visibility from the crest line the view drew for it. So a thread is visible or hidden exactly where its hole or shaft is. Where crests overlap, a visible one wins. Nothing is drawn where the view drew no crest. The crest lines are matched on paper, within the same body, with the tolerance the view's own lines were made with.

drawing.view.snapshot gets a threads list: each thread's body and the occurrences that place it, and its pieces. Each piece is a root or limit stroke, visible or hidden, with its path on paper. Scripts and agents can check a view's threads without reading pixels.

Changes a default: no

What it touches

  • crates/doc/src/drawing/thread_lines.rs (new): where a thread's lines lie on paper, and the pairing with the drawn crest lines. This is drawing-only maths, so it lives in the drawing code, not in geom. The first commit moves the earlier geom version here unchanged, with its tests.
  • crates/engine/src/drawing_view_threads.rs (new): reads each shown body's cosmetic threads. Mesh bodies and bodies without threads cost nothing.
  • drawing_view_lines.rs: paints the thread pieces with the view's thin and hidden styles. Limit lines are drawn as edges.
  • drawing_scene.rs: a sheet's cached view now includes the threads in its key. A cosmetic solid.thread edit keeps the body's geometry key, so without this the sheet kept showing the old thread.
  • The snapshot's schema and command: the threads field.

Not in this PR

  • Modelled threads (real helical geometry) and taper threads. These follow on Drawings: threads drawn in views (part of #860)  #13050 in that order.
  • Hatching in section views. A section view already draws a cut thread: the drill's edges as cut edges, the root as thin visible lines, and a limit line across. The hatching, which stops at the drill's edges, comes with section hatching.
  • Threads of one body that coincide on paper all draw. On a grid of holes seen from the front, the rows draw on top of each other. It looks right, but it costs records. Removing exact duplicates is a small follow-up.

Validation

Only the changed code's tests were run, plus planted faults:

  • solidcraft-doc drawing::thread_lines: 16 of 16. All of doc drawing: 154 of 154.
  • solidcraft-engine: the 21 new tests, and drawing_view, drawing_scene and schema: 961 of 961.
  • The new tests cover: an M8 tapped hole and an M8 shaft from the front and the top, with the root diameters to 1e-6 mm; the pairing on each side; hidden against visible crests; a thread edit redrawing a sheet's view; each placement of a tapped part drawing its own thread; the snapshot matching what the sheet draws; and every kind of bad input (never a panic).
  • 9 planted faults, 9 caught, each by a failing test, with clean runs after each restore. The faults: the pairing takes the other side's crest; the cache key leaves threads out; a hidden crest beats a visible one; a screw's root is read as its crest; the gap is in the wrong quarter; a slant counts as end on; the root is drawn on the wrong side; every limit line is drawn; the root lines are at the crest radius.
  • clippy -D warnings (doc and engine, all targets), rustfmt on every touched file, cargo xtask layers, lists, mesh-decisions (no new mesh decisions) and wasm: all pass.
  • After the rebase onto exact lines (Drawings: views are drawn from the model's exact shape, with the mesh only where they can't be (#5866) #9399) and section views (16 Nov): doc drawing:: 194 of 194; engine drawing_view, drawing_scene, drawing_picture, mesh_lines, schema and the command checks 1042 of 1043, the one failure being a_cylinders_sides_meet_its_rims_from_every_corner, listed in tests/KNOWN_FAILING_TESTS (Drawing W06a: exact orthographic hidden lines for the analytic subset #2455). clippy, rustfmt, kernel-cases --coverage and wasm pass. 3 more planted faults, all caught. One of them needed a new test, a_tapped_block_drawn_from_the_mesh_draws_its_thread: a body drawn from the mesh still gets its thread lines.

Cost (solidcraft-cli run --timings; a 100×80×20 block with 20 holes, Ø6.8 drilled 16 deep, either plain or tapped M8 12 deep; median of 5 snapshots per run):

plain front tapped front plain top tapped top
run 1 91.4 ms 85.5 ms 85.4 ms 92.9 ms
run 2 88.3 ms 87.1 ms 87.4 ms 89.7 ms
run 3 88.5 ms 88.4 ms 103.6 ms 86.9 ms

The difference is inside the run-to-run noise. The tapped runs did draw their threads: 20 threads and 60 pieces from the front, and 20 root arcs from the top.

Screenshots of the behavior

A plain test design in the real app: a 60×40×20 block with an M8 hole tapped 12 deep in a 16 mm drilled hole, and a separate M8 shaft threaded 15 mm down from its top. The front view is at 2:1 with hidden lines, with the top view above it.

Top view: both crest circles with their thin three-quarter root arcs, the gap in the upper right. The tapped hole's arc is outside its circle; the shaft's arc is inside.

2a-top-view-closer

Front view: the hole's dashed root lines, 8 mm apart, stop 12 mm deep at a dashed limit line. The drilled hole's dashed sides go on to 16 mm. The shaft's thin root lines end at a limit line 15 mm down.

2b-front-view-closer

The whole sheet at 1280×720:

1-sheet-1280x720

A small window (800×500): the sheet still fits.

3-small-window

Integration status

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Existing Defaults Unchanged Warning The PR changes a default drawing view output, and the description says Changes a default: no. Evidence from the committed code (HEAD 9687469, with b0f8145 and d518127): - `crates/engine/src/drawi… 1. Name the changed default in the PR description. Set Changes a default: yes and describe the before and after: default drawing views of tapped holes and threaded shafts now draw thread root and limit lines, and existing sheets re-render…
Full details: Existing Defaults Unchanged

Explanation

The PR changes a default drawing view output, and the description says Changes a default: no. Evidence from the committed code (HEAD 9687469, with b0f8145 and d518127): - crates/engine/src/drawing_view_lines.rs (lines_with, paper_lines) now calls threads(...) on every view build. It adds the thread pieces to Lines and paints them. No option or setting turns this off. - crates/engine/src/drawing_view_threads.rs runs for every shown non-mesh body that has cosmetic threads. The only gates are "has threads" and "is not a mesh body". - drawing_view_lines.rs also adds thread pieces to the MAX_RECORDS count. A view that was under the cap before can now be refused with "the view has more than … line pieces". This is a non-additive effect on usual use, but only near the cap. - drawing_scene.rs changes the sheet's cached view key, so existing sheets re-render with the new lines. What a user sees before and after, in the default drawing view: - Before: a tapped hole or a threaded shaft shows only its plain crest and drilled circles and edges. No root arcs, root lines, or limit lines are drawn. - After: each such thread also draws root arcs (seen end on) or root lines and limit lines (seen from the side), and hidden threads draw dashed lines. Existing drawings with threaded parts change appearance on regeneration, with no user action. - The snapshot (drawing.view.snapshot) gains a threads field. This field is additive. The default drawing output is not. The "purely additive" exception does not clearly apply. The existing lines are kept, but the default rendering of existing designs changes, and the record cap can now refuse a view that rendered before. The check also states that a Changes a default: no declaration fails when the code changes a UX default. Kernel or geometry results under solidcore/ are not in scope here. This change is in drawing output, which the check counts as the default behaviour of a command used the usual way. Not checked: whether any user has relied on the old drawings. The code shows the default output changes for every view with threaded parts.

Resolution

  1. Name the changed default in the PR description. Set Changes a default: yes and describe the before and after: default drawing views of tapped holes and threaded shafts now draw thread root and limit lines, and existing sheets re-render with them. 2. Add an opt-out (for example a view setting, default on or off as the team decides) so a user can keep the previous default rendering. Alternatively, keep the new lines behind a setting that defaults to the old output. 3. Count thread pieces separately, or exclude them from MAX_RECORDS in the usual path, so that existing views near the cap do not start to fail. Add a test for that boundary. 4. If the new default is intended, the maintainers must accept it explicitly as a default change. Then the PR can be reviewed again under this check.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@CamWight CamWight changed the title Drawings: threads drawn in views (part of #860) (#13050) Drawings: threads drawn in views (#13050) Nov 7, 2026
@CamWight CamWight closed this Nov 7, 2026
@CamWight CamWight reopened this Nov 7, 2026
@CamWight CamWight changed the title Drawings: threads drawn in views (#13050) Drawings: threads drawn in views (#13050) Nov 8, 2026
@CamWight
CamWight force-pushed the drawings-thread-13050 branch from 5c1a6c8 to 8d38692 Compare November 15, 2026 17:33
@CamWight CamWight changed the title Drawings: threads drawn in views (#13050) Drawings: views draw tapped holes and threaded shafts with standard thread lines Nov 15, 2026
@CamWight
CamWight marked this pull request as ready for review November 15, 2026 17:36
CamWight and others added 2 commits November 16, 2026 12:23
Drawings draw threads by ISO 6410's convention, not turn by turn. This
adds the geometry in the drawing code: for a thread's axis, span and
crest and root radii, its lines on a view's plane. Seen end on, the
crest's circle and the root's three-quarter arc with its gap in the
upper right; seen from the side, the crest and root lines and the limit
lines asked for; seen at a slant, none. A thread that can't be drawn
gives none, never a panic. The next commit draws them in views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#13050)

A drawing view now draws each cosmetic thread its bodies carry by the
ISO 6410 convention. End on, a thin three-quarter arc at the root, its
gap in the upper right; from the side, two thin root lines along the
thread and a limit line where it stops inside its face. The crest is
the face's own edge or silhouette, which the view already draws.

A root line lies inside its own body's material, so no hidden-line test
can see it. Each thread line takes, stretch by stretch, the visibility
of the crest line the view drew beside it (end on, the crest circle's at
that angle). Hidden ones are dashed and appear only when the style draws
hidden lines; a reference part's are thin; a shaded part's are left to
its picture. Thread strokes can't be picked.

The pairing is paper geometry in the drawing code
(`thread_lines::on_paper`), with the chord-sag tolerance the view's
exact arcs already use, now one function. The engine finds each shown
body's threads and calls it at the end of a view's lines, so the sheet
and the snapshot draw the same; the snapshot reports them as `threads`.
A view's cache key holds each body's threads, since a cosmetic thread
changes no geometry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamWight
CamWight force-pushed the drawings-thread-13050 branch from 8d38692 to 9687469 Compare November 16, 2026 14:54
@bherbruck
bherbruck merged commit 49e3277 into tangency-labs:drawings Nov 16, 2026
35 checks passed
@CamWight
CamWight deleted the drawings-thread-13050 branch November 16, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants