Commit Graph
2 Commits
Author SHA1 Message Date
Umut CANandClaude Opus 5 c607e75b75 fix(task-10): ensure annotation layers live, and put the weld symbols and their dimensions where ISO 2553 puts them
Three blocking review findings in engineering/mech/annotate.py.

1. draw_annotation_prims assigned ROLE_LAYER[role] without creating the
   layer. EzdxfBackend._apply_attrs adds a missing layer; ActiveX does not.
   MEASURED live on AutoCAD 2026 (probe: GetActiveObject, Documents.Add(),
   doc.Close(False) in finally): on a scratch document whose layer table is
   ['0'], draw_surface_texture(ComBackend(), at=(0,0), ra=3.2,
   machining='required', lay='perpendicular', allowance=0.5) raised
   "AutoCAD COM error (-0x7ffdfff7)" and left one orphan AcDbLine on layer 0
   — a partial write with no rollback, on exactly the foreign-drawing path
   the spec names (drawing_open runs no bootstrap). The same probe after the
   fix: {'ok': True, count 6, 'layers_created': ['DIM','TEXT']}, model space
   ['AcDbLine' x4 on DIM, 'AcDbText' x2 on TEXT], layer table ['0','DIM',
   'TEXT']. New helper ensure_annotation_layers() creates every target layer
   up front, before the first entity, with its ENGINEERING_LAYERS colour /
   linetype / lineweight; the result reports layers_created.

2. side='both' drew the two elementary symbols 0.4h apart — the other-side
   one still stood on the (correctly omitted) identification line, so a
   double-V butt weld came out as two detached halves that were not even
   symmetric about the reference line. ISO 2553 places them back-to-back on
   the continuous reference line: the other-side baseline is now 0.0 when
   there is no identification line. tests/test_mech_annotate.py asserted the
   wrong apex (-0.4*h), so the gate certified the defect; that test is
   rewritten to assert the mirror pair, plus a double-fillet case.

3. For side='other' the size and length were written above the reference
   line while the symbol hung below the identification line — 'a6' sat where
   an arrow-side throat dimension sits, on a joint with no arrow-side weld.
   Both texts now sit beside their own symbol (0.25h clear of the line it
   stands on, on the symbol's side). New test covers side='other' with size
   and length, and pins arrow/both unchanged.

All five new or rewritten tests fail against the pre-fix module (the layer
one with the measured 'Key not found' refusal, via a fake that models only
that measured behaviour) and pass after. tests/test_mech_annotate.py: 29
passed. Full suite: 3326 passed, 6 pre-existing failures unrelated to this
change (verified identical on the branch tip with the change stashed),
test_release_consistency.py::test_document_numbers_match_the_tree
deselected as instructed. No tool registration changed, so
docs/tool-inventory.json regenerates byte-identical.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
2026-09-22 19:15:33 +03:00
Umut CANandClaude Opus 5 a4ce46ba9b feat(mech): SECTION 23 opens with surface_texture and weld_symbol
ISO 1302:2002's seven transcribed symbol-proportion rows (text height ->
line width d', short-leg height H1, minimum height H2) drive the 60 deg
vee, the machining-required bar at H1, the machining-prohibited circle
inscribed in the vee, and the all-around circle at the kink; the Ra/Rz
values, the process, the lay symbol and the machining allowance land
around the extension line, which grows with the widest of them. A text
height outside the seven rows is refused by name rather than
interpolated, and ISO 1302 is accepted as an alias designation for
drawings still issued under it - the graphical symbol is the same one.

ISO 2553:2019's reference line, dashed identification line (omitted for a
symmetrical weld, as the standard permits), size written before the
symbol, length and pitch written after it, field-weld flag, all-around
circle and process tail. Six elementary symbols are transcribed - square,
single-V, single-bevel, single-U, single-J, fillet. The rest of the
elementary table is deliberately not shipped: a weld kind outside the six
is refused with the list of the six, because a guessed weld symbol is a
wrong instruction to a welder.

Both tools place the symbol on a plain leader - a line plus an arrowhead
with the proportions the backend's own mleader already draws - rather
than through leader_create_mleader, which refuses empty text and would
hang an MTEXT label off every symbol.

Proportions neither standard dimensions (the all-around circles, the
flag, the identification line's dashes, the text pitch and the character
width estimate) are named constants documented as this implementation's
declared choices, never as transcribed values.

No new ActiveX member is called: both tools compose LINE / ARC / CIRCLE /
LWPOLYLINE / TEXT through the entity-creation contracts both engines
already implement, so no live COM probe was needed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
2026-09-22 18:55:57 +03:00