I have found KiCAD pcbnew scripting: pcbnew.BOARD Class Reference: def pcbnew.BOARD.GetFootprint in the API, so I thought I’d try it.
So I just placed a component (here Housings_DIP:DIP-8_W10.16mm) in an empty Pcbnew file, and I tried this:
import wx, pcbnew
pcbnew.GetBoard().GetFootprint(wx.Point(19,19), -1, False)
The response to that I get, is:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/path/to/kicad/usr/local/lib/python2.7/dist-packages/pcbnew.py", line 14964, in GetFootprint
return _pcbnew.BOARD_GetFootprint(self, *args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'BOARD_GetFootprint'.
Possible C/C++ prototypes are:
BOARD::GetFootprint(wxPoint const &,PCB_LAYER_ID,bool,bool)
BOARD::GetFootprint(wxPoint const &,PCB_LAYER_ID,bool)
But then,
- I did try passing the Python counterpart to C++
wxPoint
, which iswx.Point
, as first argument (altough since it is wx, its coordinate system probably expects pixels, and not mm/inch coordinates of the PCB layout design); -
kicad-source-mirror/layers_id_colors_and_visibility.h notes that
enum PCB_LAYER_ID: int
andUNDEFINED_LAYER = -1,
- The API link notes third argument is
bool aVisibleOnly
, and I do useFalse
there
Has anyone ever tried to use this command, and has it ever worked? Maybe it is just autoexported by something that should generate a Python interface from C++ (there was software for these kinds of things, was it swig
, cannot remember), and its not meant to work in its current state?