XREF: keep layer 0 and Defpoints as the host's own

A reference's layer 0 and Defpoints are not dependent symbols: its
objects on them use the host's layers of those names, which are made
from the reference's only when the host has none. Before, they became
XREF|0 / XREF|Defpoints on load and XREF$0$0 on bind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-14 13:13:48 +03:00
1 parent 93d92b2a51
commit 0b877cbffc
1 file changed
+17
+17
View File
@@ -880,6 +880,23 @@ fn import_xref_symbols(
for layer in xref_doc.layers.iter() {
let old = layer.name.clone();
// Layer 0 and Defpoints are never dependent symbols: the reference's
// objects on them use the host's layer of the same name (made from
// the reference's when the host has none), on load and on bind.
if old == "0" || old.eq_ignore_ascii_case("Defpoints") {
if !doc.layers.contains(&old) {
let mut cloned = layer.clone();
cloned.plotstyle_handle = host_plotstyle;
cloned.material = host_material;
cloned.flags.xref_dependent = false;
cloned.xref_block_record_handle = Handle::NULL;
cloned.set_handle(doc.allocate_handle());
let _ = doc.layers.add(cloned);
}
let host = doc.layers.get(&old).map_or(old.clone(), |l| l.name.clone());
maps.layers.insert(old.to_uppercase(), host);
continue;
}
let new = naming.name_for(SymbolKind::Layer, &old);
let mut cloned = layer.clone();
cloned.name = new.clone();