fix(linetype): an opened drawing keeps exactly its own linetypes (#1826)

Opening a drawing added all 50 catalog linetypes to it, so PURGE found
and removed them again after every save and reopen. Opening now only
repairs the catalog linetypes a drawing already has. The linetype
pickers (layers, properties, ribbon, attribute editor, layer states)
offer the missing catalog ones after the drawing's own, and the one
picked, or named in LINETYPE SET, is loaded on first use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-16 01:27:50 +03:00
1 parent c499ce97d4
commit 9a567d4f44
7 files changed
+85 -5

No files matched your search

+14
View File
@@ -157,6 +157,7 @@ impl OpenCADStudio {
let art = crate::io::linetypes::extract_pattern(&lt.description);
ui::properties::LinetypeItem { name, art }
})
.chain(catalog_linetype_items(&self.tabs[i].scene.document))
.collect();
self.tabs[i].layers.sync_linetypes(lt_items.clone());
self.ribbon.set_available_linetypes(lt_items);
@@ -247,3 +248,16 @@ impl OpenCADStudio {
);
}
}
/// The catalog linetypes the drawing lacks, offered after its own; a pick
/// loads the one chosen (`ensure_catalog_linetype`).
pub(super) fn catalog_linetype_items(
document: &codec::CadDocument,
) -> impl Iterator<Item = ui::properties::LinetypeItem> {
crate::io::linetypes::catalog_missing_from(document)
.into_iter()
.map(|(name, description)| ui::properties::LinetypeItem {
name,
art: crate::io::linetypes::extract_pattern(&description),
})
}