fix: remove duplicate Y-axis negation in PinLocator.get_pin_location

The symbol-to-schematic y-flip was applied twice in sequence (two identical
negation blocks with matching comments), cancelling out and leaving pin
Y-coordinates mirrored about the placement Y. For symmetric passives the
bug is invisible (pin 1 and pin 2 are electrically interchangeable); for
ICs with non-equivalent pins (power pins, opamp inputs, etc.) this causes
tools that go through PinLocator — connect_to_net, add_schematic_connection,
add_schematic_net_label with componentRef+pinNumber — to place connections
at the mirror-flipped pin. Verified against kicad-cli generate_netlist
ground truth: on a Device:R placed at (111.76, 83.82), pin 1 resolves to
y=80.01 (actual) vs y=87.63 (pre-fix).

This is a regression of PR #103, which originally fixed the y-negation;
the redundant second block was added subsequently.

Includes a regression test with both a straight Device:R and a rotated
Device:C to exercise the y-flip + rotation pipeline.
This commit is contained in:
John Dev
2026-04-23 19:19:14 +01:00
parent a8684a1f97
commit 1c25c85de0
2 changed files with 112 additions and 3 deletions

View File

@@ -384,9 +384,6 @@ class PinLocator:
logger.debug(f"Pin {pin_number} relative position: ({pin_rel_x}, {pin_rel_y})")
# lib_symbols uses y-up; schematic uses y-down
pin_rel_y = -pin_rel_y
# Mirror in local coords after y-negate (KiCad transform order)
# mirror_x = flip across X axis → negate y
# mirror_y = flip across Y axis → negate x