Experimental support for KiCad 9 kicad-python #128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
KiBuzzard was always crashing on KiCad 9 nightlies when I tried to edit any created labels. I assumed it was a KiBuzzard issue and instead of trying to debug the SWIG interface, I decided to try the new IPC API and the
kicad-python
bindings. Turns out, I was out for an adventure.This PR, which should NOT be merged to main as-is, contains my experimental KiBuzzard version using
kicad-python
. It somewhat works, but since you can't initiate a clipboard paste or an interactive place operation from the new API, I just copy the footprint to the clipboard instead. For updates, the old footprint is removed but you still need to initiate pasting manually to replace it with the updated one.Here are rough steps to get the PR branch version working.
Prerequisites: KiCad 9 nightly (I don't think -rc2 would work but not sure about that).
Clone
kicad-python
main branch and build into a wheel (poetry build
).Clone this PR to
${KICAD_DOCUMENTS_HOME}/9.0/plugins
. Replace thekicad-python
path inrequirements.txt
with the wheel you created (should be in thedist
directory ofkicad-python
sources.To see what's going on, you might want to enable tracing for the API:
Then launch KiCad from the command line. On Linux the process is obvious, on MacOS, you need to run the binary inside the .app directory, for example:
Open a project and start PCB Editor. With a bit of luck, you'll have a KiBuzzard icon on the toolbar. Click on it. KiBuzzard will start as a separate process. On a Mac, the KiBuzzard window is always behind the PCB Editor window and isn't visible in Mission Control, but you can switch to it via the Dock. (To make this more bearable, I created a Hammerspoon snippet that raises the window automagically when it's created.))
At this point, you should have a plain old KiBuzzard dialog window. Create your label and click OK. This will close the dialog. You will need to paste the created label footprint manually on the PCB.
Editing works as before, almost: select a KiBuzzard label and click on the icon. KiBuzzard will open (behind the main window) and will have the label data preloaded. Make your changes and press OK. The old label is removed and the new one is placed on the clipboard. You will need to paste it yourself!
As of today, the PCB Editor will tend to crash soon after any footprint is pasted, so whenever you make an update, save, close and restart PCB Editor. If you don't, KiCad will do this for you, taking also the schematic editor down... A fix has been committed, so in the next nightly (after 2025-02-26), the issue might be fixed.
NOTE: My problems with the stock KiBuzzard are likely due to the same issue linked in the previous paragraph. Assuming this is the case, the stock version should work just fine and there is no reason to actually use this PR version. However, if
kicad-python
improves over time, my dabblings could be used as a basis for an updated KiBuzzard.