Skip to main content

Transform a KiCad footprint into a OpenPnP package

Project description

kicad-to-openpnp

Note: this is heavily WIP, and may introduce ghosts into your machine.

kicad-to-openpnp helps you convert your KiCad project into a set of full-fledged OpenPnP packages and parts, including pin definitions, as well as dimensions taken from 3D models of the footprints.

It does not replace OpenPnP's KiCad position file import process, it enhances it.

Installation

Using pipx (installation instructions) is recommended:

pipx install --system-site-packages kicad-to-openpnp

(--system-site-packages is required due to how KiCad distributes its Python bindings.)

Alternatively, if the above doesn't work for you (PyPi doesn't allow GitHub dependencies, so CadQuery version there is quite outdated), you can try installing directly from GitHub:

pipx install --system-site-packages git+https://github.com/mmalecki/kicad-to-openpnp.git

Usage

Assuming your board file is called board.kicad_pcb, and you're in your .openpnp2 directory, you can run the following two commands to generate your new packages.xml and parts.xml:

kicad-board-to-openpnp-packages --board board.kicad_pcb --join packages.xml > packages.new.xml
kicad-board-to-openpnp-parts --board board.kicad_pcb --join parts.xml > parts.new.xml

The --join option will preserve your previous packages and parts and add them without modification to your new files. An option to allow for updating old entities based on new findings is in the works.

Therefore, if you just want to look at what the tool would output for your current board only:

kicad-board-to-openpnp-packages --board board.kicad_pcb
kicad-board-to-openpnp-parts --board board.kicad_pcb

If the new package and part files look correct, and your OpenPnP application is closed, you can now move them in place of the old files (making backups beforehand, if you'd like):

mv packages.new.xml packages.xml
mv parts.new.xml parts.xml

Why and how?

I found inputting part heights, sizes and pads into OpenPnP to be a rather large time commitment, so I begun looking for ways to automate that.

I quickly realized that KiCad footprints don't actually contain part body size information.
However, manufacturers now happily publish STEP files of their products, and I'm yet to find a model which would be so wildly inaccurate that it would be a problem for PnP process (0.1 ~ 0.2 mm variations are typical, though).

I then used the KiCad Python bindings to read in the pads and 3D models from the footprints (accounting for rotation), and CadQuery to load the models and measure their bounding boxes. This turned out to work. I was able to run several PnP jobs using the data generated by these here scripts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kicad_to_openpnp-0.1.3.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kicad_to_openpnp-0.1.3-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file kicad_to_openpnp-0.1.3.tar.gz.

File metadata

  • Download URL: kicad_to_openpnp-0.1.3.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.11.9-amd64

File hashes

Hashes for kicad_to_openpnp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c64ab81fcbe7fd4894b5733d467869554e6a88591782a1d397f3973c70f7f76b
MD5 1195acf724a323e35bc217a053b70aa2
BLAKE2b-256 c58ea6c62b6c068332298006d93626beaf2c22d66b56d3dbd07499f45f9b55a9

See more details on using hashes here.

File details

Details for the file kicad_to_openpnp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: kicad_to_openpnp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.11.9-amd64

File hashes

Hashes for kicad_to_openpnp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aabb6d389dccbe130e2f78427d38e5c0fb466a0a467726c2ed9c6e2c5ad36f53
MD5 01cc868e82b754b01dd2df770d698399
BLAKE2b-256 9ef330489197c477540397337d612f9c1b70de1e041dcb7cfb9177b6154ae475

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page