fix(blocks): block_define refuses a non-finite base point and a missing layer unless create_layers

base_x/base_y were only float()-cast, so a NaN base point was written into
the BLOCK record; a primitive on a layer the drawing lacks was written as a
dangling reference doc.audit() never flags (and on COM would fail mid-loop
after Blocks.Add). validate_base_point names the key; the layer table is
probed before the first write and the missing names are refused, or created
and reported as layers_created when create_layers=true (new optional kwarg,
contract + both engines + tool).

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-18 00:11:38 +03:00
co-authored by Claude Opus 5
parent 7f79497928
commit 375c9f4c70
7 changed files with 165 additions and 17 deletions
+1
View File
@@ -34,6 +34,7 @@ async def test_defines_geometry_and_attdefs(backend):
"entity_count": 7,
"attdef_count": 2,
"replaced": False,
"layers_created": [],
"backend": "ezdxf",
}
blk = backend._doc.blocks.get("PID_VALVE_TEST")