Skip to content

Weldments: mitre two frame members at a corner (frame.corner, #4003) - #16684

Closed
dlucik wants to merge 4 commits into
tangency-labs:mainfrom
dlucik:abastran/frame-corner-v5
Closed

dlucik wants to merge 4 commits into
tangency-labs:mainfrom
dlucik:abastran/frame-corner-v5

Conversation

@dlucik

@dlucik dlucik commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Part of #4003. Draft until Karl decides how #5312 goes on (take our carried commit, or refresh #5312 himself; asked in #5312). This replaces #8452, which was closed because it had drifted from main (#8452 (comment)). The code is the same as there, now on current main. It still includes the fix for Karl's acute-angle review (#8452 (comment)).

Stacked on #5312 (Trim/Extend). #5312 is still open and does not merge cleanly into main. So the bottom commit of this branch is #5312 (head 015e7a50f) squashed onto main, with Karl as its author. It is unchanged except where main moved under it; the commit message lists each change. This PR's own change is only the top three commits. When #5312 lands or Karl refreshes it, we drop the bottom commit and rebase. Reviewing only our part: git diff <bottom commit> HEAD.

Changes a default: no

Change

Frame members (structural steel laid along sketch lines, #4003) overlap where two of them meet at a corner. frame.corner joins two members that meet at their ends in a mitre. It cuts both ends on the plane halfway between them, so a right-angled corner cuts each at 45°. The members keep their bodies and names.

  • It builds on Weldments: trim and extend frame members to other members, planes, or faces #5312's member mechanism, not a second one. Members are found by {feature, line} (find) and rebuilt from their line and profile with an end moved to a plane (build). Their records are updated, so corners, trims and later corners see each member as it now is. The tail of trim that puts the rebuilt body in place moved into a shared replace helper; trim's behaviour is unchanged.
  • The members meet where the lines through the middle of their profiles cross. The mitre plane passes through that point, square to the difference of the two directions away from it.
  • A profile placed off its middle (an outline anchor, or locate from Frames: place a member by a profile point that stays put when the size changes #15726) moves that point away from where the lines meet, by up to (|ob| + |cos θ|·|oa|) / sin θ for line offsets oa, ob at an angle θ. The end check allows exactly that move, so off-centre profiles work at any angle.
  • gap (a length expression, default 0, at most 1 m, as for trims) is the distance between the two cut faces. Each face stands gap / 2 back from the mitre plane.
  • Refused, with the reason: not exactly two members; one member twice; parallel or collinear members; middle lines that pass apart; a line end farther than its profile's size from the corner (a T: trim it instead); an unknown kind; a gap outside 0…1 m; members changed by later features; an open sketch.
  • kind is mitre only for now. The field exists so butt and end-trim corners land without a format change of their own.
  • Command with input and output schemas (CornerParams, FeatureResult), timeline.redefine support, CLI recipe op frame_corner, a docs/frames.md section and a mitre glossary entry. No dialog or ribbon button yet; the timeline shows the Trim/Extend icon. Those come with the UI step.
  • Design format: one new file, crates/doc/src/format/pending/frame-corners.rs. No kernel files or dependencies change.

Validation

Every expected value is a hand calculation. None is measured from a kernel or another program.

  • Square frame, 45 × 45 bar round a 600 × 400 rectangle, 4 mitres. Each bar reaches 22.5 past its line's ends at the outer corners. Volumes 2025 × 600 = 1,215,000 and 2025 × 400 = 810,000 mm³ for the long and short bars. Both ends of every bar are cut at 45°. Joined, the four bars keep the whole volume (no overlap left).
  • Gap 3: each end moves 1.5 / cos 45° = 1.5 √2 along its bar; volume 2025 × (L − 3 √2) per bar.
  • 40 × 40 × 3 tube, gap 2: A · (600 − 2 √2) and A · (400 − 2 √2), with A the tube's area.
  • 60° corner of two 200 long bars: each cut 60° from square, the outer edge 22.5 √3 past the corner, volume 2025 × 200 each; gap 4: volume 2025 × 196.
  • Acute corners with outline anchors (Karl's review): lines at 15°, 30° and 60°, 45 bar bottom_left, the bars outside the angle. Each bar keeps 2025 × (200 + 22.5 · cot(θ/2)); at 30° that is 575,041.5649 mm³. A bar leaving the middle of another at 30° (a T) is still refused.
  • The frame width as a parameter (600 → 800): the mitres follow. Lines stopping 10 short of the corner: both bars extend to it. Undo, redo, save and reopen keep the corners. Hostile parameters never panic.
  • Analytic reference case tests/oracle/97-frame-mitre: the 600 × 400 frame with a 2 mm gap, V = 2025 (2000 − 8 √2) = 4,027,089.74 mm³, centre (300, 200, 0).

Run on this branch (e3260caac, on main 87adb81eb), Linux (WSL2, x86_64):

  • cargo test -p solidcraft-engine frame: 186 passed, 0 failed, 1 ignored (among them the 10 frame.corner tests in cmd::frame and the corner schema test).
  • cargo test -p solidcraft-doc frame: 42 passed, 0 failed.
  • cargo test -p solidcraft-ui-egui frame -- --skip gpu::: 143 passed, 0 failed, 7 ignored.
  • solidcraft-cli oracle tests/oracle/97-frame-mitre: PASS. 96-frame-tower (Weldments: trim and extend frame members to other members, planes, or faces #5312): PASS.
  • cargo xtask ci: fmt, assets, layers and clippy (-D warnings) pass. The test step is not fully green here, for the same reasons as on clean main. Clean main 87adb81eb, run on the same machine: 18 tests fail in 6 test binaries (fillets, setback and G2 corners in SMLib and the kernel, the naming corpus, the action matrix, two settings-card tests, one render-queue test, one mirrored-part mesh test). This branch: the same 18, plus two UI tests that pass when run alone (stand_up_offer::an_unknown_exporter_lying_on_its_back_gets_the_note_not_the_dialog, render_workspace::tests::async_path_host::setup_progress_is_estimated_from_the_last_setup_on_the_adapter; 1 of 1 each, timing under load). None of the failing tests is a frame test.

Screenshots of the behavior

After (4 mitres, 2 mm gap), from solidcraft-cli snapshot:

v5-frame-mitre

After: the 600 × 400 frame of tests/oracle/97-frame-mitre, four mitres with a 2 mm gap.

Integration status

Checked 2026-11-13: main at 87adb81eb; #5312 open, head 015e7a50f, conflicting with main. Conflicts resolved in the bottom commit (listed in its message): layout() from #15726 folded into #5312's layout, member_section (End Cap, #8606) reads the member from it before any trim, and End Cap and Trim/Extend sit side by side in the commands, dialogs and ribbon.

We build steel structures, and keeping every member a body of one part (as #4003 proposes, not a file per member) is the workflow we want too.

(ABASTRAN, steel structures.)

🤖 Generated with Claude Code
Sponsored by ABASTRAN

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
Pre-merge checks: Passed 1

Check name Status Explanation
Existing Defaults Unchanged Passed The check passes. The PR's own commits (bfccecd, 72822e7, e3260ca, on top of the carried #5312 commit 1cd54d3) add a new frame.corner command, its schema types, a redefine entry, a CLI recipe …
Full details: Existing Defaults Unchanged

Explanation

The check passes. The PR's own commits (bfccecd, 72822e7, e3260ca, on top of the carried #5312 commit 1cd54d3) add a new frame.corner command, its schema types, a redefine entry, a CLI recipe op, docs, a glossary entry and oracle cases. Nothing removes or changes an existing UX default: - No settings, preferences, keymap or shortcut files are touched. A search of the changed paths for settings/prefs/keymap/shortcut/default returned none. - The only UI change is crates/ui-egui/src/timeline.rs. It adds FeatureKind::FrameCorner to the existing FrameTrim arm, so corners reuse the Trim/Extend icon. Existing icon mappings are unchanged. - crates/engine/src/cmd/edit.rs adds "frame.corner" to an accepted-constructor list. This is additive. - recipe.rs adds a new frame_corner arm. Existing ops are unchanged, apart from a comment. - Removed lines in the handler and doc code are refactors (the shared replace helper). The PR says trim behaviour is unchanged, and the removed lines I saw do not alter existing commands or dialogs. - The description states Changes a default: no. That matches the code I reviewed. Caveat: I audited the PR's own three commits, not the carried #5312 bottom commit in full. Its UX content is Trim/Extend, which the description says is separate from this PR. Kernel and geometry changes under solidcore/ are excluded by the check's own wording.

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

@github-actions github-actions Bot added area:doc timeline, components, parameters, naming area:infra CI, tooling, repo, docs area:ui desktop/web front end, dialogs, viewport labels Nov 14, 2026
@paulgcrabb

Copy link
Copy Markdown
Contributor

Hello, I am about to complete work on extending the "Frame" dialogue that creates mitre, Butt, coped joints. It will "auto" create joints, typically butt joints for a "frame"... but you can then select individual joints and flip the direction of the butt joint or change the joint to mitre.

I was going to create a PR today with the code... but I don't want to tread on your toes... but I think you may like what it does.

@dlucik

dlucik commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

@paulgcrabb thanks for asking first, and no toes trodden on: please open your PR. Auto-created joints that you can flip or switch to a mitre sound like what a frame needs.

Two things would help us line the two up:

If yours covers this one, we're happy to close #16684 and help test yours instead. We'd rather have one corner path than two. Our hand-calculated cases (square frame, gap, 60° and acute corners with outline anchors) are in this PR and can move over.

(ABASTRAN, steel structures.)

@dlucik
dlucik force-pushed the abastran/frame-corner-v5 branch from e3260ca to 5f7609f Compare November 14, 2026 21:55
@paulgcrabb

Copy link
Copy Markdown
Contributor

@paulgcrabb thanks for asking first, and no toes trodden on: please open your PR. Auto-created joints that you can flip or switch to a mitre sound like what a frame needs.

Two things would help us line the two up:

If yours covers this one, we're happy to close #16684 and help test yours instead. We'd rather have one corner path than two. Our hand-calculated cases (square frame, gap, 60° and acute corners with outline anchors) are in this PR and can move over.

(ABASTRAN, steel structures.)

Hello, Mine doesn't reference other work, it does all these within it's functionality, it extends the "Frame" dialogue. Typically you apply it to each frame "sketch", and then add addtional "Frames" to build up any tubes that connect frames. This video shows the basic functionality. If you use a "butt" joint then you can select a "joint" and "flip" the direction of the butt joint.

Frame_Auto_joint.mp4

@dlucik

dlucik commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@paulgcrabb thanks for the video, the auto joints with a per-joint flip look really good. That is exactly the part a frame is missing.

A suggestion so the two fit together rather than compete: let your dialogue be the interface, and let it write the corner as a feature the rest of the model can read.

Why it matters downstream:

kind was left open for butt and coped joints, so adding yours there is a small change, and we're glad to help with it and with tests. @Karl-VonRichter, does that split (dialogue on top, frame.corner + Trim/Extend underneath) match how you see the frame features?

(ABASTRAN, steel structures.)

Karl-VonRichter and others added 4 commits November 16, 2026 09:46
… onto main)

The eleven commits of tangency-labs#5312 (head 015e7a5) squashed onto current main,
so the frame corners can build on them. Karl's code is unchanged except
where main moved underneath it:

- doc/eval_frame.rs: main's `layout()` (tangency-labs#15726, `locate` and the profile
  origin) folded into tangency-labs#5312's `Layout`/`Laid`; `member_section` (End Cap,
  tangency-labs#8606) now reads the member from that layout, before any trim.
- doc/eval.rs, doc/model_cache.rs: main's `construct` key and thread runs
  kept beside `frame_members`.
- engine/schema/frame.rs: tangency-labs#5312's trim contract appended to main's frame
  contracts (tangency-labs#12500); its schema test joins main's test file.
- engine/cmd/frame.rs, ui-egui dialogs, workspace, docs/frames.md: End
  Cap and Trim/Extend side by side.
- `resolve_plane_in` takes the component; `Traced` has a `recipe`;
  `crate::i18n::{tr, format}` became `solidcraft_ui_text::{tr, format}`;
  the Trim/Extend icon master moved to crates/look/icons with main.

Co-Authored-By: Łukasz Dłucik <lukasz.dlucik@abastran.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: ABASTRAN (https://abastran.com)
frame.corner joins two frame members that meet at their ends: both are
rebuilt from their line and profile with the end at the corner cut on the
plane halfway between them, the cut faces `gap` apart. It builds on the
Trim/Extend member records (find, build, and a replace helper now shared
with frame.trim), so corners and trims see each member as it now is.

Refused with the reason: not two members, one member twice, parallel
members, middle lines that pass apart or cross away from a member's ends,
an unknown kind, a gap outside 0..1 m, and members changed later.

Tests from hand calculation: a 600 x 400 frame (45 deg cuts, volume from
the section area, no overlap left, gap shortening by gap / sqrt 2), a 60
deg corner (60 deg cuts, outer edge 22.5 sqrt 3 past the corner, gap 4
moving each end by 4), width parameter edits, extension, undo/reopen and
hostile parameters. Analytic reference case 97-frame-mitre.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: ABASTRAN (https://abastran.com)
…labs#8452)

frame.corner checked that the middle lines cross within the profile's
diagonal of each member's end. A profile anchored off its middle moves
that crossing by up to (|ob| + |cos θ|·|oa|) / sin θ, which grows as the
angle closes: two 45 bars on their inner edges 30° apart meet
22.5 · cot 15° = 83.971 past their lines' ends, and were refused.

The check now takes the anchors' move out first, using the exact
crossing of the offset lines (derived in a comment at the check), and
then requires each line's end within its profile's size of where the
lines meet, so a T is still refused. All four end pairs are tried and
the nearest taken, since at sharp angles the corner can lie nearer a
member's far end.

Tests from hand calculation: 15°, 30° and 60° corners of 200 long bars
on bottom_left (cut 90° − θ/2 from square, outer edge 45 · cot(θ/2) past
the corner, volume 2025 × (200 + 22.5 · cot(θ/2)) each), and an acute T
still refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: ABASTRAN (https://abastran.com)
Register frame_corner in main's feature-kind mappings (kind_key and the
type-name lookup), as 9b9bb569c does for frame_trim, and keep BAR45 for
the corner tests now that the trim tests that defined it became table
driven engine tests in tangency-labs#5312.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sponsored-by: ABASTRAN (https://abastran.com)
@paulgcrabb

Copy link
Copy Markdown
Contributor

@dlucik - I didn't really understand that reply - can you try explaining it again, sorry for wasting your time with this.

@dlucik

dlucik commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

@paulgcrabb not at all, my reply was too dense. Shorter:

  1. Your dialogue is great. Please send it.
  2. One request: when the user picks a joint in your dialogue, save it as a frame.corner feature (from this PR), instead of cutting the tubes inside the dialogue's own code.
  3. Why: other tools then see every corner. The cut list reads lengths and angles from it, and Ahmad's three-member corner (Weldments: end a post flat under two mitred rails in one corner (frame.corner, #4003) #16756) already builds on it. If each tool cut corners its own way, they would not see each other's corners.

If frame.corner is missing something your dialogue needs (butt, coped, flip), tell us and we'll add it.

(ABASTRAN, steel structures.)

@paulgcrabb

Copy link
Copy Markdown
Contributor

I will take a look at saving as frame.corner, I don't have any good reason not to.

The likelihood of any weldment PR getting merged seems remote - this area seems to be completely ignored by whoever controls the releases, I am going to abandon my work within the next few days and will close my PRs

@paulgcrabb

Copy link
Copy Markdown
Contributor

@dlucik ... today I re-worked #17855 completely to follow the structure for frame elements in #4003, I added frame.multi_trim so I could achieve 3D joints and partial tube intersections that need notches. I am going to "push" in Discord to see if I can get #17855 merged so there is some decent functionality available in weldments that will then get it moving forward.

@khanahmad4527

Copy link
Copy Markdown
Contributor

@dlucik, since #17855 (automatic frame corners) merged, main gives this PR's numbers for its own test cases. I ran them on main 40c61c3 (0.46.2) with solidcraft-cli, using one Frame Member with Corner Type Mitre and the frame's gap, and the same 45 × 45 bar:

Case (this PR's test) Expected here main
600 × 400 frame, gap 0 (a_square_frame_mitres_at_its_four_corners) bars 2025 × 600 and 2025 × 400; Bar box −22.5 … 622.5; total 2025 × 2000 1,215,000 and 810,000 mm³; Bar box −22.5 … 622.5; total 4,050,000 mm³; inspect.interference finds no overlap
gap 3 (a_mitre_gap_shortens_each_bar_by_its_share_at_the_middle_line) 2025 × (600 − 3√2); Bar from −22.5 + 1.5√2 1,206,408.65 mm³; Bar from −20.3787
60° corner, two bars 200 long (a_sixty_degree_corner_cuts_each_bar_at_sixty_degrees) each 2025 × 200; X bar from −22.5√3 405,000 mm³ each; X bar from −38.9711

The 600 x 400 frame of 45 mm bar mitred at its four corners, built on main

(Headless render, solidcraft-cli snapshot, 1280 × 720.) I did not run the acute-angle and stop-short cases. Unless those still differ, this PR looks covered by main now. The same holds for #16756, the three-member corner stacked on it; I posted the numbers there: #16756 (comment). Your call whether to close it.

@dlucik

dlucik commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing this in favour of #17855 — corner treatments now live on frame.member, and @khanahmad4527 re-ran our
two-member cases on main with the same numbers (thanks!).

Two cases from this PR were not covered by that comparison, as Karl noted in #4003: acute mitres and members whose
ends stop short of each other (extend/trim to the mitre plane). If main differs on either, I'll send it as a small
separate fix with a hand-computed test, not as a restack of this branch.

One gap remains for the steel cut list: the end cuts built in frame.member are not recorded anywhere, so a cut
list cannot report end angles. A small follow-up PR records each member's two ends (cut plane, or a coped/fitted
marker) without changing the geometry; details in #4003.

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:ui desktop/web front end, dialogs, viewport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants