From 15147260c12e146d4ce4f5c3560e4e12ba90d53c Mon Sep 17 00:00:00 2001 From: Vinicius Augusto Date: Sat, 24 Oct 2026 02:48:15 -0300 Subject: [PATCH] INSERT from a file brings the file's multiline styles (#1639) Inserting a DWG/DXF as a block merged its layers, linetypes and text, dimension, multileader and table styles, but not its multiline styles. A drawing that brings its wall styles in by inserting a library file (AutoLISP add-ons do this: INSERT walls.dwg, ERASE the reference, then MLINE with one of its styles) got "Cannot find multiline style". The styles now merge like the other tables: a name the drawing already has keeps the drawing's definition. Co-authored-by: Claude Opus 5.5 --- crates/engine/src/cmd/blocks/insert_file.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/engine/src/cmd/blocks/insert_file.rs b/crates/engine/src/cmd/blocks/insert_file.rs index 9e0621b1..4d0af93b 100644 --- a/crates/engine/src/cmd/blocks/insert_file.rs +++ b/crates/engine/src/cmd/blocks/insert_file.rs @@ -149,6 +149,7 @@ fn merge_tables(d: &mut Drawing, src: &Drawing) { merge(&mut d.dim_styles, &src.dim_styles, |t| &t.name); merge(&mut d.mleader_styles, &src.mleader_styles, |t| &t.name); merge(&mut d.table_styles, &src.table_styles, |t| &t.name); + merge(&mut d.mline_styles, &src.mline_styles, |t| &t.name); } /// Which source blocks to copy, and under which name: new names keep theirs, generated @@ -255,4 +256,17 @@ mod tests { assert_eq!(file_ref(&s, "C:\\parts\\bolt.dxf").map(|f| f.name), Some("bolt".into())); assert!(file_ref(&s, "BOLT").is_none()); } + + #[test] + fn inserted_file_brings_its_mline_styles() { + let mut src = Drawing::default(); + src.mline_styles.push(cadcraft_doc::MLineStyle { name: "WALL".into(), ..Default::default() }); + let mut d = Drawing::default(); + merge_tables(&mut d, &src); + assert!(d.mline_styles.iter().any(|m| m.name == "WALL")); + // A style this drawing already has keeps its own definition. + let before = d.mline_styles.len(); + merge_tables(&mut d, &src); + assert_eq!(d.mline_styles.len(), before); + } }