Files
Akhil Velagapudi a31b48b499 Use API-only generic BOM matching (#1100)
* Preserve BOM match provenance in output

* Remove local generic BOM matching

* Fix grouped BOM status rendering

* Cache BOM sourcing groups atomically

* Shorten BOM changelog entry
2026-08-27 14:42:06 -04:00

54 lines
2.5 KiB
Python

"""Comprehensive test for PinHeader component."""
load("../../interfaces.zen", "Net")
load("../PinHeader.zen", "Mount", "Pitch", "Orientation", "Gender")
PinHeader = Module("../PinHeader.zen")
for orientation in Orientation.values():
for pitch in Pitch.values():
for gender in Gender.values():
for mount in Mount.values():
for rows in [1, 2]:
for positions in [1, 2, 4, 5, 6, 7, 8, 9, 10, 20]:
# Skip invalid combinations (footprints don't exist in KiCad)
if pitch.value == "1.27mm" and gender.value == "Female" and orientation.value == "Horizontal":
continue
# Skip invalid combinations (SMD horizontal is not available)
if orientation.value == "Horizontal" and mount.value == "SMD":
continue
# SMD single row requires at least 2 pins
if mount.value == "SMD" and rows == 1 and positions < 2:
continue
# SMD dual row Female requires at least 2 pins per row
if mount.value == "SMD" and rows == 2 and positions < 2 and gender.value == "Female":
continue
# Generate the component name
pitch_str = pitch.value.replace(".", "_")
gender_str = gender.value
orientation_str = orientation.value
mount_str = mount.value
pin_prefix = "_".join(
["P", mount_str, orientation_str, pitch_str, gender_str, str(rows), str(positions)]
).upper()
pins = {"P{}".format(n): Net(pin_prefix + "_" + str(n)) for n in range(1, positions * rows + 1)}
name = "_".join(
["J", mount_str, orientation_str, pitch_str, gender_str, str(positions) + "x" + str(rows)]
)
# Instantiate the component
PinHeader(
name=name,
mount=mount,
pins=positions,
rows=rows,
orientation=orientation,
pitch=pitch,
gender=gender,
**pins,
)