SECTION 24 grows to six tools: revision_add, bom_extract, bom_table,
balloon_add.
bom_extract reads. It walks the INSERTs through the generic members already in
the contract -- entity_list, block_get_attributes, entity_get_xdata -- and
returns parts-list rows from the ACADMCP_MECH std_part payload, falling back to
the block's own ATTRIBs and reporting which of the two each row came from. A
block with neither is skipped rather than guessed at, and the tool never writes
to the drawing.
bom_table draws the rows as a real TABLE, 180 mm wide (ISO 7573: the item list
is as wide as the title block), growing upwards from directly above it with the
heading row against the block and item 1 the row above -- which is what ISO 7573
asks for on a drawing. A TABLE is drawn downwards from its insertion point, so
the upward list is inserted a table height above its anchor with the heading as
the last row; one table_layout feeds both the real TABLE and the pure
table_prims, so the two renderings cannot disagree.
balloon_add draws the ISO 6433 reference -- numeral, leader, dot on the item --
and writes the balloon payload naming its targets. A rerun over the same
targets renumbers that balloon instead of drawing a second one, and an item
number already used for different targets is refused by name with the other
balloon's handle.
revision_add appends a row to the revision block, is idempotent per revision
code (a repeat draws nothing at all), and optionally clouds the changed regions
and tags them with the triangle. Clouds are refused up front, carrying
capability "revcloud", on an engine that has no revcloud member -- the COM
backend -- rather than leaving half a revision behind.
Declared: ISO 7200 does not standardise the revision block's geometry and
ISO 7573 does not fix the item list's column widths or row height, so both
reuse this repository's 180 mm / 7 mm ruling and say so in their SOURCE
docstrings. ISO 6433's "numeral at least twice the dimension character height"
is met by the numeral being 1.4x the balloon radius: the 4 mm default clears
2.5 mm dimension text, and balloon_add's docstring tells a sheet dimensioned at
3.5 mm to pass radius=5.0.
Three corrections to what the plan wrote, each measured rather than assumed:
* extract_records read `block_get_attributes(...)["attributes"]`. Both engines
return the flat {tag: value} mapping itself (ezdxf_backend.py:6687 builds it
from `ent.attribs`, com_backend.py:5703 from `ref.GetAttributes()` as
{TagString: TextString}), so every attribute fallback would have been
silently empty -- measured headlessly, where a PLATE insert carrying only a
DESIGNATION ATTRIB extracted to nothing.
* draw_bom_table now reports `entity_type` / `representation` /
`child_handles`. `entity_create_table` returns EntityInfo(type="TABLE") whose
handle is the first CHILD of a composite on the headless engine, so reading
that handle back gives a rule LINE, not an ACAD_TABLE -- the contract
tests/test_table_leader.py already pins. A caller that means to edit the
table afterwards has to be told which of the two it got.
* add_revision reports one `tags` entry per tag asked for ({at, handles}), not
one per entity: a tag is two primitives, so a flat handle list claimed twice
as many tags as the caller requested.
Discovery: `bom_extract` / `bom_table` / `balloon_add` each entered the index
heavy with "parts"/"list" tokens and took top-1 for the bare query "parts list"
away from `entity_create_table` (a BM25 tie broken alphabetically). Narrowed on
my side only -- the reader speaks of the bill of materials, the drawer names a
table, the balloon names an item -- never by touching the golden case.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
85 lines
1.7 KiB
Python
85 lines
1.7 KiB
Python
"""The sheet standard: ISO 5457 frames, ISO 7200 title blocks, ISO 7573 parts
|
|
lists, ISO 6433 balloons and the delivery formats."""
|
|
|
|
from engineering.sheet.bom import (
|
|
BOM_COLUMNS,
|
|
COLUMN_LABELS,
|
|
DEFAULT_COLUMNS,
|
|
LIST_WIDTH,
|
|
ROW_HEIGHT,
|
|
add_balloon,
|
|
balloon_prims,
|
|
draw_bom_table,
|
|
extract_records,
|
|
read_balloons,
|
|
rows_from_records,
|
|
table_prims,
|
|
)
|
|
from engineering.sheet.frames import (
|
|
CENTRING_OVERSHOOT,
|
|
EDGE_MARGIN,
|
|
FILING_MARGIN,
|
|
SHEET_LAYER,
|
|
SHEET_TEXT_LAYER,
|
|
SHEETS,
|
|
TRIM_MARK_LONG,
|
|
TRIM_MARK_SHORT,
|
|
ZONE_DIVISIONS,
|
|
ZONE_MODULE,
|
|
draw_sheet_frame,
|
|
draw_sheet_prims,
|
|
enter_layout,
|
|
frame_metrics,
|
|
frame_prims,
|
|
sheet_size,
|
|
zone_divisions,
|
|
)
|
|
from engineering.sheet.revision import (
|
|
REVISION_COLUMNS,
|
|
add_revision,
|
|
read_revisions,
|
|
revision_block_prims,
|
|
revision_heading_prims,
|
|
revision_row_prims,
|
|
revision_tag_prims,
|
|
)
|
|
|
|
__all__ = [
|
|
"BOM_COLUMNS",
|
|
"CENTRING_OVERSHOOT",
|
|
"COLUMN_LABELS",
|
|
"DEFAULT_COLUMNS",
|
|
"EDGE_MARGIN",
|
|
"FILING_MARGIN",
|
|
"LIST_WIDTH",
|
|
"REVISION_COLUMNS",
|
|
"ROW_HEIGHT",
|
|
"SHEETS",
|
|
"SHEET_LAYER",
|
|
"SHEET_TEXT_LAYER",
|
|
"TRIM_MARK_LONG",
|
|
"TRIM_MARK_SHORT",
|
|
"ZONE_DIVISIONS",
|
|
"ZONE_MODULE",
|
|
"add_balloon",
|
|
"add_revision",
|
|
"balloon_prims",
|
|
"draw_bom_table",
|
|
"draw_sheet_frame",
|
|
"draw_sheet_prims",
|
|
"enter_layout",
|
|
"extract_records",
|
|
"frame_metrics",
|
|
"frame_prims",
|
|
"read_balloons",
|
|
"read_revisions",
|
|
"revision_block_prims",
|
|
"revision_heading_prims",
|
|
"revision_row_prims",
|
|
"revision_tag_prims",
|
|
"rows_from_records",
|
|
"sheet_size",
|
|
"table_prims",
|
|
"zone_divisions",
|
|
]
|