fix(blocks): entity_create_block_ref refuses an undefined or layout block before writing, on both engines
Track A's task-1 gate covered block_insert only; the sibling tool still returned a handle for a typo'd name that doc.audit() later deleted, and both tools accepted *Model_Space (a reference cycle). One gate per engine (_require_block / _require_block_defined) is now shared by both placing tools: non-string name -> TypeError, unknown -> ValueError naming it, layout block -> ValueError, all before add_blockref / InsertBlock. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5
parent
49fc6ac6a5
commit
b9510bf377
@@ -1656,7 +1656,14 @@ async def entity_create_block_ref(
|
||||
layer: Annotated[str | None, "Layer name"] = None,
|
||||
ctx: Context = None,
|
||||
) -> dict:
|
||||
"""Insert a block reference (instance of an existing block definition)."""
|
||||
"""Insert a block reference (instance of an existing block definition).
|
||||
|
||||
Refused before any write, on both engines: a name that is not a block
|
||||
definition in this drawing (`block 'X' is not defined` — check
|
||||
`block_list`), a layout block (`*Model_Space` / `*Paper_Space`, a
|
||||
reference cycle) and a non-string name. The same gate as `block_insert`;
|
||||
this tool is the no-attributes form.
|
||||
"""
|
||||
await ctx.debug(f"Inserting block '{name}' at ({x},{y})")
|
||||
result = await _backend(ctx).entity_create_block_ref(
|
||||
name, x, y, scale_x, scale_y, rotation, layer
|
||||
|
||||
Reference in New Issue
Block a user