KiCad Testpoints Plugin

Over the past few months I’ve been working on turning the internal tools we’ve developed at EOI/HEO for various projects into a new company. We recently launched TheJigsApp to make the design and manufacturing of test jigs fast and painless. As will be obvious from this blog I really enjoy KiCad which I recently discovered has the dubious distinction of being one of three EDA programs listed on Wikipedia that has had an update in the last decade that doesn’t have a test point report generation function in the GUI. I know this might be a bit specific but whatever, there’s only so many hours in the day and I’m writing this at 2 am.

Enter: KiCad Testpoints PCM

It’s incredibly simple — but let’s keep that between us. I’m honestly proud of this section of code, which I realize is both brilliant and possibly unwise:

_fields = {
    'source ref des': lambda p: p.GetParentFootprint().GetReferenceAsString(),
    'source pad': lambda p: p.GetNumber(),
    'net': lambda p: p.GetShortNetname(),
    'net class': lambda p: p.GetNetClassName(),
    'side': get_pad_side,
    'x': lambda p: pcbnew.ToMM(p.GetCenter())[0],
    'y': lambda p: pcbnew.ToMM(p.GetCenter())[1],
    'pad type': lambda p: "SMT" if (p.GetDrillSizeX() == 0 and p.GetDrillSizeY() == 0) else "THRU",
    'footprint side': lambda p: "BOTTOM" if p.GetParentFootprint().GetSide() else "TOP"
}

def build_test_point_report(board: pcbnew.BOARD) -> list[dict]:
    test_point_property = 4
    lines = []
    for p in board.GetPads():
        if p.GetProperty() != test_point_property:
            continue
        lines.append({
            key: value(p) for key, value in _fields.items()
        })
    return lines
_fields = {
    'source ref des': lambda p: p.GetParentFootprint().GetReferenceAsString(),
    'source pad': lambda p: p.GetNumber(),
    'net': lambda p: p.GetShortNetname(),
    'net class': lambda p: p.GetNetClassName(),
    'side': get_pad_side,
    'x': lambda p: pcbnew.ToMM(p.GetCenter())[0],
    'y': lambda p: pcbnew.ToMM(p.GetCenter())[1],
    'pad type': lambda p: "SMT" if (p.GetDrillSizeX() == 0 and p.GetDrillSizeY() == 0) else "THRU",
    'footprint side': lambda p: "BOTTOM" if p.GetParentFootprint().GetSide() else "TOP"
}

def build_test_point_report(board: pcbnew.BOARD) -> list[dict]:
    test_point_property = 4
    lines = []
    for p in board.GetPads():
        if p.GetProperty() != test_point_property:
            continue
        lines.append({
            key: value(p) for key, value in _fields.items()
        })
    return lines

It’s just a table of lambdas. I think that strikes a rare balance between being elegant and unhinged. At the very least, it keeps concerns localized.

See It In Action

Anyway check out the plugin in the KiCad PCM.

Test Point Report GUI

Test Point Report Spreadsheet

This plugin complements the command-line tool kicad-testpoints by adding GUI support for generating test point reports. The report format is compatible with the CLI tool, so you can use it in both manual and automated build workflows.

DescriptionLink
Git Repohttps://github.com/TheJigsApp/kicad-testpoints-pcm
KiCad PCM Browserhttps://www.kicad.org/pcm/
DocumentationGenerating a Test Point Report