feat(task-7): SECTION 25 catalogue - arch_catalogue_list, arch_catalogue_insert
engineering/arch/catalogue.py is the standard-parts pattern of track B for an architectural plan: twenty authored plan symbols in two families - thirteen furniture items (single and double bed, wardrobe, three-seat sofa, armchair, chair, dining table with four chairs, desk, kitchen counter run, fridge, bookshelf, nightstand, coffee table) and seven sanitary items (WC, bidet, wall basin, shower tray, bathtub, kitchen sink, washing machine). Every size is a nominal catalogue dimension and says so in SIZE_BASIS, in each row and in both tool docstrings; no standard is cited because none fixes these sizes. Each item is typed block_define primitives on layer 0 inside [0, w] x [0, d], origin at the back-left corner with the wall side along +X - a test holds all twenty to their footprint. catalogue() searches name, family and the English and Turkish labels, ignoring case and Turkish diacritics (buzdolabi finds buzdolabı). insert_item() defines ARCH_<NAME> once, creates the furniture or sanitary layer from its ARCH_LAYERS row when missing (live ActiveX refuses a missing layer), inserts with an invisible ITEM attribute, and refuses an unknown name with the nearest catalogue names before any write. SECTION 25 opens on this branch with the two tools, alias records (INSERT, ADCENTER, TOOLPALETTES and English/Turkish synonyms), a regenerated inventory, the README snapshot at 231 tools, and the branch-local group snapshot (entity_query 10, entity_creation 19) that the track F merge recomputes. No new ActiveX call: insert_item composes the existing layer_list, layer_create, block_list, block_define and block_insert members. Run once live through ComBackend on AutoCAD 2026 (scratch document, closed after): all twenty items defined and inserted, a second double_bed insert reported defined=false, ITEM read back as double_bed, 20 ARCH_* blocks, 21 INSERTs on A-FURN-E-N / A-SANR-E-N, both layers created at ACI 5 / 0.18 mm. Co-Authored-By: Claude Opus 5.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.5
parent
d5c5e90406
commit
afd42356b5
@@ -9780,6 +9780,114 @@ async def drawing_export_dwg(
|
||||
return await _backend(ctx).drawing_export_dwg(str(validated), version)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ── SECTION 25: Architecture (2 tools) ──────────────────────────────────────
|
||||
# ---------------------------------------------------------------------------
|
||||
# ── arch: catalogue (group C) ──
|
||||
|
||||
|
||||
@cad_tool(
|
||||
summary="Search the furniture and sanitary catalogue in English or Turkish.",
|
||||
cost="read",
|
||||
)
|
||||
@mcp.tool(
|
||||
annotations={"title": "Architecture: Catalogue", "readOnlyHint": True},
|
||||
tags={"arch", "query"},
|
||||
)
|
||||
async def arch_catalogue_list(
|
||||
query: Annotated[
|
||||
str | None,
|
||||
Field(
|
||||
default=None,
|
||||
description=(
|
||||
"Words matched against the item name, family and its English or Turkish "
|
||||
"label, ignoring case and Turkish diacritics - 'bed', 'yatak', 'klozet', "
|
||||
"'buzdolabi'. Every word must match."
|
||||
),
|
||||
),
|
||||
] = None,
|
||||
family: Annotated[
|
||||
str | None,
|
||||
Field(default=None, description="furniture | sanitary"),
|
||||
] = None,
|
||||
lang: Annotated[
|
||||
str,
|
||||
Field(default="en", description="en | tr - the language of the 'label' column"),
|
||||
] = "en",
|
||||
ctx: Context = None,
|
||||
) -> dict:
|
||||
"""Catalogue rows: name, family, both labels, nominal size [w, d] in mm, block name, layer.
|
||||
|
||||
Sizes are nominal catalogue dimensions - what a furniture or appliance
|
||||
catalogue lists as a common size - and every row says so in `size_basis`;
|
||||
they are not standards values. Twenty items: thirteen furniture, seven
|
||||
sanitary. Refusals: a `family` other than furniture/sanitary and a `lang`
|
||||
other than en/tr, each with the list.
|
||||
"""
|
||||
from engineering.arch.catalogue import FAMILIES, SIZE_BASIS, catalogue
|
||||
|
||||
try:
|
||||
rows = catalogue(query, family, lang=lang)
|
||||
except ValueError as exc:
|
||||
raise ToolError(str(exc)) from exc
|
||||
return {
|
||||
"count": len(rows),
|
||||
"families": list(FAMILIES),
|
||||
"size_basis": SIZE_BASIS,
|
||||
"items": list(rows),
|
||||
}
|
||||
|
||||
|
||||
@cad_tool(
|
||||
summary="Insert a furniture or sanitary item - bed, sofa, WC, basin, bathtub - as a block.",
|
||||
cost="mutate",
|
||||
)
|
||||
@mcp.tool(
|
||||
annotations={"title": "Architecture: Catalogue Insert", "readOnlyHint": False},
|
||||
tags={"arch", "create"},
|
||||
)
|
||||
async def arch_catalogue_insert(
|
||||
name: Annotated[
|
||||
str,
|
||||
Field(
|
||||
description=(
|
||||
"Catalogue name from arch_catalogue_list, e.g. 'double_bed', 'sofa_3_seat', "
|
||||
"'wc', 'wall_basin', 'kitchen_counter'"
|
||||
)
|
||||
),
|
||||
],
|
||||
x: Annotated[float, Field(description="X (WCS) of the item's back-left corner")],
|
||||
y: Annotated[float, Field(description="Y (WCS) of the item's back-left corner")],
|
||||
rotation: Annotated[
|
||||
float,
|
||||
Field(
|
||||
default=0.0,
|
||||
description=(
|
||||
"Degrees CCW about (x, y); 0 puts the item's back (its wall side) along +X "
|
||||
"with the item extending towards +Y"
|
||||
),
|
||||
),
|
||||
] = 0.0,
|
||||
ctx: Context = None,
|
||||
) -> dict:
|
||||
"""Define the item's block ARCH_<NAME> once, insert it on the furniture or sanitary layer.
|
||||
|
||||
The block carries an invisible ITEM attribute with the catalogue name. Its
|
||||
size is a nominal catalogue dimension (reported with `size_basis`), not a
|
||||
standards value; the outline is a plan symbol drawn inside that footprint.
|
||||
The furniture / sanitary layer is created from the `arch` layer set when
|
||||
the drawing lacks it. Refusals, all before any write: an unknown name
|
||||
(with the nearest catalogue names) and a non-finite coordinate or rotation.
|
||||
"""
|
||||
from engineering.arch.catalogue import insert_item
|
||||
|
||||
await ctx.info(f"arch catalogue: {name} at ({x}, {y})")
|
||||
try:
|
||||
return await insert_item(_backend(ctx), name, at=(x, y), rotation=rotation)
|
||||
except ValueError as exc:
|
||||
raise ToolError(str(exc)) from exc
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ── RESOURCES ───────────────────────────────────────────────────────────────
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user