molecule check takes an inner Edge.Cuts hole (a bore) as the board outline

John Lauer · ·closed by John Lauer

What happens

adom-aiflow molecule check (0.2.6) reports every machine pin and contact of a molecule as outside the outline when the board has a hole in Edge.Cuts. It takes the inner cutout as the board outline.

Repro: a 60 x 84 mm molecule with a 9.2 mm round bore at its centre (a rotary encoder ring: the outer outline is lines plus corner arcs on Edge.Cuts, the bore one gr_circle on Edge.Cuts).

adom-aiflow --run <run> molecule check --board sensor.kicad_pcb --spec spec.json
ERROR: molecule check on sensor.kicad_pcb: 16 error(s), 1 warning(s)
ERROR MP1 centre is OUTSIDE the outline, 57.21 mm from the board edge; the molecule edge margin is 2 mm
...

MP1 sits at (-28, -55) mm from the bore centre: 61.7 mm away, minus the 4.6 mm bore radius, is the 57.2 mm reported. So the "outline" being tested is the bore circle, not the outer edge. The board itself passes KiCad's DRC (0 violations, 0 unconnected, schematic parity) and its pins really are 2 mm inside the outer edge with rounded corners centred on them.

Expected

The outline is the outermost closed Edge.Cuts loop. Inner closed loops (bores, slots, cutouts) are holes: pins and contacts must keep the edge margin from them too, but "outside the outline" should be judged against the outer loop only.

Also

WARN the aux axis origin is (100.00, 100.00), not MP1 is right and fine as a warning. The same board was checked as a generator output and as a KiCad-saved copy; both give the 16 errors.

1 Reply

John Lauer ·

Fixed in adom-aiflow 0.2.7.

The cause was wider than molecule check. The board reader returned the first closed shape it met on Edge.Cuts (a gr_circle, gr_rect or gr_poly) as the board outline, and dropped any lines and arcs. So a bore drawn as a circle became "the outline" for every consumer, not just the molecule check. And a cutout drawn in lines next to a lines-and-arcs outline could not be chained at all ("not one closed loop").

Now:

  • The reader collects every closed Edge.Cuts loop. The outline is the loop with the largest area. Every other loop is kept as a cutout (Board.outline_cutouts).
  • molecule check judges "inside" against the outer loop only. A pin or contact inside a cutout is an error. The edge margin applies to cutout edges too, and the message says whether the board edge or a cutout edge is the near one.
  • The router treats a cutout as off-board and keeps edge clearance from its rim, so it won't route through or hug a bore.

Reproduced on the buck molecule with a 9.2 mm Edge.Cuts bore added at its centre: 0.2.6 reported 12 errors, every machine pin "OUTSIDE the outline". 0.2.7 reports only J7's off-grid point, which that board has without the bore too. outline check stays clean on the bored board. Unit tests cover a lines outline with a circle bore, a lines outline with a lines slot, a pin too close to a cutout, and the router's mask around a bore.

Upgrade: adom-wiki pkg install adom/adom-aiflow, then adom-aiflow --version says 0.2.7.

John Lauer closed this ·
Colby Knox mentioned this in pull request #78 ·

Log in to reply.