Skip to content

Sketch: paste copied sketch geometry into another design (#9258) - #9675

Merged
bherbruck merged 2 commits into
tangency-labs:mainfrom
PaddleStroke:feat/9258-cross-document-paste
Oct 31, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:mainfrom
PaddleStroke:feat/9258-cross-document-paste

Conversation

@PaddleStroke

@PaddleStroke PaddleStroke commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Change

Part of #9258. On main, bodies and components copied in one design already paste into another open design (#3511), and so do completed sketches as timeline features (#5427). Sketch geometry copied inside a sketch did not: sketch.copy keeps its clipboard in the design's own session, so in a sketch of another tab Ctrl+V said "Nothing to paste: copy sketch geometry first" and the context menu's Paste was greyed out.

With this change, sketch entities copied or cut in a sketch (Ctrl+C / Ctrl+X, or the context menu) paste into a sketch of another open design with Ctrl+V or the context menu's Paste. The geometry lands at the cursor, or at the copied coordinates when the pointer is off the viewport. The constraints and dimensions among the copied entities come with it, and the paste is one undo step, the same as a paste within one design.

  • References across designs: a dimension whose expression names the copied design's parameters (for example w) is pasted with its value as a number in the same unit. It is not tied to a parameter of the same name in the target design, which may mean something else (this follows the reporter's comment that standalone geometry is what they need). A dimension typed as a number keeps its number. A pasted text keeps its words, height and angle as numbers.
  • Engine: SketchClip::for_another_design() (crates/engine/src/cmd/sketch_clipboard.rs) prepares the clipboard for another design. It also sets the source sketch id to none, because sketch ids repeat across designs and a matching id would offset the paste as if it went back into its own sketch.
  • UI: SolveApp::foreign_sketch_clip keeps the last sketch copy, using the same "last copy in any design wins" stamps as the existing cross-design body and component copy (crates/ui-egui/src/edit_clipboard.rs). The sketch context menu's Paste uses the new can_paste_sketch.
  • Not in this PR: pasting a whole sketch onto a plane or face the user picks in the other design. Completed sketches already paste as features through Design - Sketch: unexpected result - Coping sketch from one document to another (not working) #5427.

No new commands, UI strings, design-format changes or dependencies.

Changes a default: no

Validation

  • cargo fmt --all -- --check: clean.
  • cargo clippy -p solidcraft-engine -p solidcraft-ui-egui --all-targets -- -D warnings: clean.
  • cargo test -p solidcraft-engine --lib sketch_clipboard: 9 passed. This includes the new sketch_geometry_pastes_into_another_design_with_values_not_foreign_parameters: a dimension driven by w = 1 in pastes as 25.4 mm into a design whose own w is 3 mm, that w stays untouched, the paste lands at the copied coordinates even though the target sketch has the same id, and a second paste lands there again.
  • cargo test -p solidcraft-ui-egui --lib edit_clipboard: 33 passed, 3 failed. The new sketch_geometry_copies_into_a_sketch_of_another_design passes: Ctrl+C in a sketch, new tab, Paste is off outside a sketch and on in the sketch's context menu, Ctrl+V pastes the 4 lines at the cursor with both dimensions in one undo step, and a copy made later in the second tab is what pastes back in the first. The 3 failures are the middle-button tests, which panic inside epaint on this machine with "Dropped TexturesDelta". This is known local noise and unrelated to the change.
  • Not run: the full cargo xtask ci, cargo xtask wasm and the other xtask checks (the engine change is plain Rust with no new dependencies). After rebasing onto main 60b9e9d there was no conflict, and the build was not run again.

Screenshots of the behavior (when observable)

Debug build, empty designs, driven over the control channel.

Steps: in design A, set the user parameter w = 60 mm and draw a sketch: a rectangle with width w and height 30, and an 8 mm hole. Select it all and press Ctrl+C. Open a new tab (design B), set its own w = 10 mm, create a sketch on XY and press Ctrl+V.

Before (main): in B's sketch, Ctrl+V reports "Nothing to paste: copy sketch geometry first" (no screenshot: a second app build would have taken about 40 minutes on the shared machine).

After, design A: the copied geometry, with the width driven by w (fx: 60.00 mm):
copied in design A

After, design B: pasted with its dimensions. The width is a plain 60.00 mm, not B's w (10 mm). The status reads "Pasted 5 sketch entities". In B, parameters.list shows d1 = 60, d2 = 30, d3 = 8, and w is still 10 mm.
pasted in design B

Integration status

Rebased onto upstream main 60b9e9d with no conflicts. No other open PR covers #9258. #2250 (point-to-point sketch move and clipboard placement) touches the same clipboard files but does not cover pasting sketch entities across designs.

🤖 Generated with Claude Code

PaddleStroke and others added 2 commits October 31, 2026 04:41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#9258)

Sketch geometry copied or cut in a sketch (sketch.copy / sketch.cut) now pastes into a sketch of another open design with Ctrl+V or the context menu, at the cursor or at the copied coordinates, with the constraints and dimensions among it. A dimension whose expression names the copied design's parameters keeps its value, in its unit; a text keeps its numbers. SketchClip::for_another_design prepares the clipboard; the app keeps the last sketch copy beside the cross-design body/component copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PaddleStroke
PaddleStroke force-pushed the feat/9258-cross-document-paste branch from 6ce572f to c0eab48 Compare October 31, 2026 03:41
@PaddleStroke
PaddleStroke marked this pull request as ready for review October 31, 2026 03:42
@bherbruck bherbruck added ready to merge reviewed, every ask addressed; merge once CI is green approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Oct 31, 2026
@bherbruck
bherbruck enabled auto-merge October 31, 2026 03:54
@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Oct 31, 2026
@bherbruck
bherbruck added this pull request to the merge queue Oct 31, 2026
Merged via the queue into tangency-labs:main with commit c2f6610 Oct 31, 2026
145 of 166 checks passed
@PaddleStroke
PaddleStroke deleted the feat/9258-cross-document-paste branch November 30, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants