Skip to content

D151 — Clearances resolved in KiCad's order; copper graphics compared as KiCad compares their nets

Context

After D150, vme-wren still had 425 clearance and 20 shorting reports from the engine's DRC that KiCad 10.0.6 does not make:

  • Clearance. The engine floored every clearance at the board minimum (0.125 mm), but the board's custom rule allows 0.1 mm under the FPGA and the DDR. KiCad's DRC_ENGINE::EvalRules returns a matching custom rule's value before the board-minimum floor, and checks a pad's local override before any custom rule.
  • Shorting. These were between shapes of one footprint: copper lines that meet in the outline of each U.FL connector. In KiCad a footprint's copper shape has no net at all (PCB_SHAPE::IsConnected) and nets are compared by pointer, so two footprint shapes are never tested against each other, and neither are two board-level items without a net.

Doc 08 §3.2, records in bench/records/d151-clearance.

Decision

  • RuleEngine::clearance in KiCad's order:
  • a local override (pad, then footprint), floored at the board minimum;
  • else the last matching custom rule, final with no floor;
  • else the net class, with the coupled-pair relaxation and a zone's own clearance, floored at the board minimum.
  • hole_clearance and hole_to_hole: a matching custom rule replaces the board minimum instead of being raised to it.
  • Copper graphics:
  • two footprint graphics (of one footprint or of two) are not checked against each other;
  • a board graphic is not checked against another board item without a net (graphic, pad, track or via).
  • Hole names: a hole without copper is named "NPTH pad of " in reports, as KiCad names it, and is listed in its hole_clearance reports.

Alternatives

  • Keep the floor as a safety margin. The router would keep 0.125 mm where the designer allowed 0.1 mm under a BGA. Fan-outs there need the rule, and the DRC would keep reporting errors that KiCad does not.
  • Port KiCad's pointer and UUID-order logic for graphics in full. Whether an overlap is a short or a clearance error depends on which of the two items has the larger UUID, and the engine keeps no UUIDs. The two rules above are the ones the fixtures need.

Consequences

  • vme-wren matches KiCad on every routing-relevant type, and jetson still does. Of the other 15 demo boards 12 match as before; microwave's shorts go from 10 to 8 (KiCad 6), One-Air-Max and RoyalBlue differ as before.
  • Rule parity: 239 cases, five new, all matching KiCad. The D149 build fails all five.
  • Among the fixtures only vme-wren has a rule below its board minimum, and no board with custom clearance rules has local overrides, so no bench board routes differently.
  • On merge with D139 (branch cache-safe-custom-rules), its check that the per-class cache judges custom rules as the exact check does must use this order.