Closed bug report

silkscreen-audit: bounding boxes turn 45-degree labels and round pads into false collisions; build the input from the board

noah · ·closed by John Lauer

Found on AM32 ESC v1 (48 hand-placed labels, the test-point labels at 45 degrees), 0.2.51; unchanged in 0.2.54.

What happened. The skill and the --record check ask the AI to build the audit input from the board. Built the obvious way (each label's bounding box, each pad's bounding box, as the earlier am32-esc-32 run did), the audit reported 54 collisions and 10 labels "on exposed copper". KiCad's own shape test (GetEffectiveTextShape().Collide(pad.GetEffectiveShape(F_Cu))) finds ink on exactly one pad. A 45-degree label's axis-aligned box covers about twice its ink; a round pad's box (test point, contact, machine pin) adds four empty corners. The AI was led to report false problems to the human.

What worked. The schema already allows boxes: one box per stroke (GetEffectiveTextShape().GetSubshapes()), round pads and silk circles as four stacked boxes that hold every point of the circle (at most 8 % past it), vias as their full box, as --record requires. The same board then shows 45 collisions, each one real or a policy question (a label touching a test point's silk ring or inside a contact's courtyard circle). Script attached (build_silk_audit.py, as .txt; pcbnew 10.0.6).

Ask. silkscreen-audit --board <board> should build this input itself from the saved board instead of every AI writing its own builder, so the pass and fail are the same for every engine, and the hint should say the audit is a rectangle check.

build_silk_audit.py.txt

1 Reply

John Lauer ·

Thanks Noah. Your measurement (54 reported collisions where KiCad's shape test finds ink on one pad) made the cause clear, and the attached builder showed the fix.

What was wrong. silkscreen-audit is a rectangle check: every label box against every obstacle box. The skill told each AI to build that input itself, and the obvious build (one bounding box per label, one per pad) turns a 45 degree label into a square about twice its ink, and a round pad into a square with four empty corners. Every engine wrote its own builder, so the same board could pass for one engine and fail for another.

What changed (in adom-aiflow 0.2.56).

  • silkscreen-audit --board <board> --out result.json [--record]: leave out --input and the audit builds its input from the saved board (default: the run's current board). It writes the input beside --out as silkscreen-audit-input.json, so you can see what was checked. No pcbnew is needed; it reads the .kicad_pcb.
  • The builder gives shapes, not bounding boxes, each cut into 0.1 mm strips so the rectangle check sees the shape:
    • each label is its turned text rectangle (size, length, rotation and stroke, from AI Flow's stroke-font estimate);
    • each pad is its own outline (round pads as circles) plus 0.05 mm for the mask opening;
    • each part body is its F.Fab outline, or its courtyard when there is no Fab drawing;
    • the footprints' own silk artwork is one obstacle per footprint and side;
    • vias are their full square, as --record requires.
  • Every footprint and via is in the inventory, so --record can still tell that the audit covers the board.
  • The hint now says the audit is a rectangle check and explains why a hand-built input with one box per item reports collisions in the empty corners.
  • Collisions are now findings: the command exits 0, no proof is recorded, and the result file names each collision. An unreadable input is still an error. --input still takes a hand-built inventory, so your pcbnew builder's output works as before.

How it was verified. Unit tests cover: a 45 degree, 0.8 mm TP1 label beside a 2 mm round test pad, whose bounding boxes overlap (the old false collision) while the built shapes are clear; the strips hold every vertex of the shape; and the built input passes the --record geometry checks (every pad inside its own footprint's boxes, every via covered). A new CLI suite (tests/silk-fab-workflow.py) checks that a label on its own pads is reported as a finding with exit 0, and that moving the label off clears the audit. I also ran it on two real boards here (502 and 38 parts); neither has 45 degree labels. All unit tests and workflow suites pass.

Still open. A label is its text rectangle, not one box per stroke as in your pcbnew script. That needs KiCad's stroke font, and it is slightly more conservative: a rectangle corner that crosses a pad where no stroke does still counts. I could not run it on AM32 ESC v1 (I don't have the board here), so I'd be glad to hear what it reports on your 48 labels.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.56.

John Lauer closed this ·

Log in to reply.