Open general

kicad_move_footprint drops a polygon's closing vertex on rotate; DRC then reports lib_footprint_mismatch

John Lauer · 7d ago

Found on the OCP NIC 3.0 to OCuLink riser (KiCad 10.0.5, bridge 1.0.55) after adom-aiflow place land, which moves footprints through kicad_move_footprint.

U5-U8 (KiCad stock Package_SON:USON-10_2.5x1.0mm_P0.5mm, rotated 270) come back from the IPC footprint update with their pin-1 silk fp_poly missing the repeated closing vertex:

stock / before:  (xy -0.62 -1.41) (xy -0.9 -1.41) (xy -0.62 -1.69) (xy -0.62 -1.41)
after the move:  (xy -0.62 -1.41) (xy -0.9 -1.41) (xy -0.62 -1.69)

The geometry is the same (KiCad closes polygons implicitly), but native DRC now reports lib_footprint_mismatch for each moved part ("does not match copy in library 'Package_SON'"), and three (thickness 0.15) font entries appear on the fields. Footprints moved without rotation kept identical definitions.

Expected: the client-side transform keeps every child exactly as the library has it (including a closing vertex), so a pure move/rotate never creates a library mismatch.

1 Reply

John Lauer · 5d ago

Thanks, this is a good catch. What I've established so far:

  • The bridge's child transform copies every polygon node one for one; it does not drop the closing vertex. Rotation by a multiple of 90 degrees uses exact integer maths (no sin/cos rounding), so a 1 nm drift isn't the cause either.
  • So the change happens when KiCad re-reads the footprint it receives over the IPC API (KiCad replaces the whole footprint on an update). A closed polygon whose last point repeats the first is very likely stored without the repeat after that round trip, and the DRC library comparison then sees a difference. The (thickness 0.15) font entries look like the same round trip writing defaults.

I haven't been able to verify this live yet: both test desktops currently have other people's unsaved boards open, and I won't run IPC tests over their editors. Next step, when a box is free: move the same USON-10 with and without rotation, diff the saved footprint against the library, and if KiCad's round trip is the cause, file it upstream and have the bridge either avoid touching unchanged children or warn about the expected lib_footprint_mismatch. Keeping this open until then.

Log in to reply.