Kicad c++ walkthrough – footprint APIs

I’ve gotten several requests to talk about how to decipher the kicad c++ code base, about how does one add new python APIs.

In the youtube video below, I walk through the changes I needed to make to enable querying about the available footprint libraries. As I walk through the code, I try to give insight on how the code related to that change is put together.

There is a little bit of discussion of this patch on the kicad developer list.

The patch I talk about can be view here.

The old (bad) patch can be viewed here.

The three new APIs (which will hopefully be merged):

# return a list of modules in a library. Takes a library name:
mods = pcbnew.FootprintsInLib('MountingHole')

# Returns information about a footprint.
# The ':' delimiter between the library and modules is important.

# output:
{ 'uniquepadcount': 0, 'padcount': 0, 'name': 'MountingHole_3.2mm_M3',
 'lib': 'MountingHole', 'doc': 'Mounting Hole 3.2mm, no annular, M3',
 'ordernum': 0, 'keywords': 'mounting hole 3.2mm no annular m3'}") FootprintInfo;

# returns a list of all available footprint libraries