fix(task-2): block_explode keeps the ATTRIB frame and writes into the owner layout

Two silent wrong-place defects in the BURST path. An ATTRIB is an OCS
entity, so the TEXT that replaces it now carries extrusion/thickness with
insert/align_point; a mirrored reference (ATTRIB reflected to (0,0,-1),
INSERT +Z with yscale=-1) put the tag 50 units across the mirror axis with
a clean audit. Members and TEXTs now go into the INSERT's owner layout
(ezdxf get_layout, COM ObjectIdToObject(OwnerID)) instead of the current
space: a sheet title block exploded while Model was current duplicated
geometry into model space and then died on delete_entity headless, and on
COM landed the tag text in model space with ok: True. A reference nested
in a block definition is refused before any write on both engines.

Five regression tests (mirrored INSERT, sheet-owned INSERT with Model
current, nested INSERT, and the COM owner-block / nested-refusal call
shapes) fail on the previous commit and pass here.

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-16 21:43:08 +03:00
co-authored by Claude Opus 5
parent 19610b8f05
commit 13851a3d20
4 changed files with 225 additions and 11 deletions
+8 -4
View File
@@ -3032,10 +3032,14 @@ async def block_explode(
Every attached ATTRIB becomes a TEXT with the same value, placement,
height, rotation and layer (an invisible attribute becomes an invisible
TEXT); AutoCAD's plain EXPLODE would keep only the tag-name placeholders
and drop the values. Returns `inserted_handles` (the geometry),
`attribute_texts` (one TEXT handle per attribute), `exploded_handle` and
`backend`. Refused: a handle that is not a block reference (nothing is
written). Not undoable except through `drawing_undo` / a transaction.
and drop the values. Everything lands in the layout that owns the
reference (model space or its paper-space sheet), whichever tab is
current. Returns `inserted_handles` (the geometry), `attribute_texts`
(one TEXT handle per attribute), `exploded_handle` and `backend`.
Refused, with nothing written: a handle that is not a block reference,
and a reference nested inside a block definition (explode the outer
reference instead). Not undoable except through `drawing_undo` / a
transaction.
"""
await ctx.warning(f"Exploding block reference {handle}")
return await _backend(ctx).block_explode(handle)