Add Y-flip swap for vertical pin rotation in sexp fallback
Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions

Pin angles in lib_symbol use Y-up convention. After applying component
rotation, vertical directions (90/270) must be swapped to account for
the lib Y-up to schematic Y-down coordinate transform. Without this,
vertical stubs on non-mirrored components point into the body instead
of away from it, causing label_multiple_wires ERC violations.
This commit is contained in:
Ryan Malloy 2026-03-09 02:01:59 -06:00
parent 32a1f1427e
commit 718f226c24

View File

@ -1128,11 +1128,22 @@ def resolve_pin_position_and_orientation(
target_pin["x"], target_pin["y"], cx, cy, comp_rot, mirror_x,
)
# Compute schematic-space pin rotation
# Compute schematic-space pin rotation.
# Pin angles in lib_symbol use Y-up convention. After applying the
# component rotation, vertical directions must be swapped (90 <-> 270)
# to account for the lib Y-up -> schematic Y-down coordinate flip.
# For mirrored components, the mirror is applied first.
pin_rot = target_pin["rotation"]
if mirror_x:
pin_rot = (180 - pin_rot) % 360
schematic_rot = (pin_rot + comp_rot) % 360
# Y-flip: swap vertical directions for non-mirrored components.
# Mirror already handles the inversion via (180 - pin_rot).
if not mirror_x:
if schematic_rot == 90:
schematic_rot = 270
elif schematic_rot == 270:
schematic_rot = 90
logger.debug(
"Resolved pin %s.%s via sexp fallback: (%.2f, %.2f) @ %.0f°",