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 the following section of the code which I’m aware is concerning:

_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 iterating over a table of lambdas which I believe is equal parts brilliant and brain dead. At very least it is truly paying attention to the localization of concerns.

Anyway checkout the plugin in the KiCAD PCM.

Test Point Report GUI

Test Point Report Spreadsheet

This plugin complements the existing command line tool kicad-testpoints by adding a way of generating the report in the GUI. The format the GUI plugin generates can be used with our command line tool for automated builds.

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