From e39c4b4424fdfed5b7d6cd6b7ceb95508b84e2d0 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 22 Jun 2026 19:50:58 +0300 Subject: [PATCH] fix(clipboard): refresh blocks/meshes on PASTEORIG and PASTEBLOCK PASTECLIP recreated missing block definitions, tessellated pasted solids, and refreshed the layer panel after a paste; PASTEORIG and PASTEBLOCK did not. A block pasted through either of those rendered empty because its definition was never recreated in the target drawing. Both paths now call merge_clipboard_blocks (so referenced/nested block definitions exist) and populate_meshes_from_document (so pasted ACIS solids tessellate); PASTEORIG also refreshes the layer panel. Co-Authored-By: Claude Opus 4.8 --- src/app/commands.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/app/commands.rs b/src/app/commands.rs index e8c9b59a4..f11714039 100644 --- a/src/app/commands.rs +++ b/src/app/commands.rs @@ -627,10 +627,18 @@ impl OpenCADStudio { // each entity with fresh handles (top-level + inline subs) // so a same-document paste can't duplicate handles. (#129) self.merge_clipboard_deps(i); + // …and any block definition the pasted INSERTs reference, + // else a block reference renders empty in a drawing that + // lacks the definition. (#135 / #158) + self.merge_clipboard_blocks(i); for entity in self.clipboard.clone() { self.tabs[i].scene.add_entity_clone(entity); } + // Tessellate any pasted ACIS solids (top-level + inside a + // recreated block) so they render instead of staying blank. + self.tabs[i].scene.populate_meshes_from_document(); self.tabs[i].dirty = true; + self.refresh_layer_panel(); self.refresh_properties(); self.command_line.push_output(&format!( "PASTEORIG: {} object(s) pasted at original coordinates.", @@ -648,6 +656,10 @@ impl OpenCADStudio { } else { self.push_undo_snapshot(i, "PASTEBLOCK"); self.merge_clipboard_deps(i); + // Recreate any block definition the clipboard's INSERTs + // reference, so nested blocks inside the new wrapper block + // don't render empty. (#135 / #158) + self.merge_clipboard_blocks(i); let name = self.unique_block_name("Block"); let base = self.clipboard_centroid; let entities = self.clipboard.clone(); @@ -661,6 +673,7 @@ impl OpenCADStudio { // user picks the drop point (insertion uses the // clipboard centroid as the block's base). The // clipboard wires rubber-band under the cursor. + self.tabs[i].scene.populate_meshes_from_document(); self.tabs[i].dirty = true; let wires = self.tabs[i].scene.wires_for_entities(&self.clipboard); use crate::modules::insert::insert_block::InsertBlockCommand;