fix(ezdxf): block_insert with attributes referenced an anonymous *U block and lost its ATTRIBs

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
Umut CAN
2026-09-15 13:10:41 +03:00
co-authored by Claude Opus 5
parent abc2a82e71
commit be7dfa86d3
2 changed files with 49 additions and 5 deletions
+6 -5
View File
@@ -4453,12 +4453,13 @@ class EzdxfBackend(AutoCADBackend):
}
if layer:
attribs["layer"] = layer
ref = msp.add_blockref(name, (float(x), float(y)), dxfattribs=attribs)
if attributes:
ref = msp.add_auto_blockref(
name, (float(x), float(y)), attributes, dxfattribs=attribs
)
else:
ref = msp.add_blockref(name, (float(x), float(y)), dxfattribs=attribs)
# `add_auto_blockref` wraps the INSERT in an anonymous *U block,
# so the returned handle names `*U1` and carries no ATTRIBs.
# `add_auto_attribs` attaches ATTRIBs to this INSERT for every
# ATTDEF the definition has; values for tags it lacks are ignored.
ref.add_auto_attribs({str(k): str(v) for k, v in attributes.items()})
self._mark_dirty()
return _entity_info_dxf(ref)