如何使用 KiCAD pcbnew 插件 Python API 遍历封装焊盘

使用以下方式遍历给定 pcbnew.FOOTPRINT 对象的焊盘

iterate_pads_example.py
for pad in list(footprint.Pads()):
    # Example of what to do with [pad]
    print(f"{footprint.GetReference()} {pad.GetNetname()}")

如何为板上的每个封装打印所有焊盘的示例:

iterate_all_footprints_pads.py
for footprint in list(pcbnew.GetBoard().GetFootprints()):
    for pad in list(footprint.Pads()):
        # Example of what to do with [pad]
        print(f"{footprint.GetReference()} {pad.GetNetname()}")

例如,这将打印:

example_output.txt
D1 Net-(D1-K)

Check out similar posts by category: KiCad, Python