sparkfunX / Buzzard

Software tools for EAGLE silkscreen generation
100 stars 18 forks source link

Add support for KiCad #21

Closed gregdavill closed 3 years ago

gregdavill commented 3 years ago

This pull request adds support for exporting these beautiful labels into KiCad.

This is designed to work with KiCad Nightly (and v6 when it is released in the coming months) I've separated the changes out into 3 commits

Commit 1

KiCad does not support "self-intersecting" polygons, which it appears Eagle does. So the first commit addresses this. I have not tested this in Eagle, and currently it only works when 3 polygons are nested, this is the common case seen with a block background. Note: this code currently wouldn't handle a case where 4 polygons are nested, but I don't think that occurs with standard letters. Let me know if you know of a counter example.

Example:

Without any changes, 3 nested contours get combined. You can see that polygon outlines are present but are incorrect. Screenshot from 2021-01-14 01-13-52

With this commits changes, note the center polygon is now treated as a separate entity in the footprint. Screenshot from 2021-01-14 01-02-34

Commit 2

Added stdout output mode. The easiest way to drop these labels into KiCad will be through the clipboard. Enabling output via stdout enables running a script like this:

python buzzard.py "<GPIO 10>" -a cc -o ki -stdout | xclip -sel c -noutf8

Then simply pasting Ctrl+V the generated label onto a board layout.

Commit 3

Added KiCad output support, KiCad footprints appears to be the best option to create a container around multiple polygons. polygons are defined with a small header/footer and a list of x/y points.

The KiCad output option is enabled with the -o ki argument. If writing to a file we use the .kicad_mod extension.

gregdavill commented 3 years ago

From the Github view, I saw a few bits of the original code that fell through the cracks when I was formatting the commits. Hence those force pushes.

WardBenjamin commented 3 years ago

@gregdavill it should be relatively easy to turn this into an action plugin (so it would be as easy to use as the normal text tool); I'm happy to do so if you don't plan to.

gregdavill commented 3 years ago

@WardBenjamin I've have already made an initial mock up: https://github.com/gregdavill/KiBuzzard

Here is a demo: https://twitter.com/GregDavill/status/1349689955694465031 I wanted to avoid adding the ActionPlugin code directly to the Buzzard code base.

WardBenjamin commented 3 years ago

@gregdavill makes sense - looks great! Let me know if I can lend a hand.

NPoole commented 3 years ago

This doesn't seem to break EAGLE functionality so I'm merging! Awesome work! I'll add a few lines to the README documenting the added arguments