Importing KiCad footprints

519 views
Skip to first unread message

Duncan Ellison

unread,
Dec 1, 2023, 11:39:41 AM12/1/23
to OpenPnP
Can anyone give me a steer on how to import footprints into OpenPnP from KiCad using the button that's appeared in Packages>footprint.  I've been searching, but can't find any mention in the docs.

I know footprints aren't super popular, but I find them pretty useful. 

Duncan Ellison

unread,
Dec 1, 2023, 2:18:28 PM12/1/23
to OpenPnP
OK, I think I got it, didn't really need any documentation.  Download .mod files as a package from https://kicad.github.io/footprints/ then just import them one at a time with the Ki import button

Mark Jones

unread,
Oct 11, 2024, 3:03:17 PM10/11/24
to OpenPnP
Where did you see this button @duncan? I've downloaded the latest version of OpenPNP and can't see it under Packages, select Package in table, Footprint tab. +1 for using footprints and this would be super helpful to have. 

Also if you could share any footprints that would be super helpful. This has been the most annoying part of project setup for me. 

Thanks,
Mark 

Maiko Herrmann

unread,
Jul 19, 2025, 10:44:25 PMJul 19
to OpenPnP
I also can't import Kicad 9 footprints into the "Packages" TAB.
I open the .MOD file using the "import a footprint from Kicad Module" button, but nothing happens... 
Any tips? I need to redo my entire Packages.xml file... because I lost everything.
Thanks a lot!

Maiko Herrmann

unread,
Jul 20, 2025, 6:15:37 PMJul 20
to OpenPnP
I took advantage of Sunday to make a script to convert kicad footprints to export to Packages in openpnp, if anyone else needs it, here is the attached file in Python.
convert.py
convert.png

Zdenko Stanec

unread,
Jul 22, 2025, 2:57:04 AMJul 22
to OpenPnP
Hi,

Nice job! I will give it a try for sure,

Zdenko,

Mike Menci

unread,
Jul 22, 2025, 8:59:43 AMJul 22
to OpenPnP
Can you please shortly describe how to use this Python script ? 

Maiko Herrmann

unread,
Jul 22, 2025, 9:31:25 AMJul 22
to OpenPnP

How to Install Python and Set Up Your Environment for KiCad Footprint Converter

This guide will walk you through installing Python and the required libraries (tkinter and pyperclip) to run the KiCad Footprint to OpenPnP XML Converter script. It's crucial to correctly set up your environment, especially enabling access from the command line, to ensure the script runs smoothly.

Step 1: Install Python

  1. Download Python: Go to the official Python website: https://www.python.org/downloads/

  2. Choose the Latest Stable Version: Download the latest stable release (e.g., Python 3.x.x).

  3. Run the Installer:

    • Crucial Step for Command Line Access: When you run the installer, MAKE SURE to check the box that says "Add Python X.Y to PATH" (where X.Y is your Python version). This step is vital because it allows you to run Python commands directly from your Command Prompt (Windows) or Terminal (macOS/Linux). If you miss this, you'll need to manually add Python to your system's PATH, which is more complex.

    • Click "Install Now" (or "Customize installation" if you want to change the installation path, but "Install Now" is usually fine).

    • Follow the on-screen prompts to complete the installation.

Step 2: Verify Python Installation

  1. Open Command Prompt/Terminal:

    • Windows: Press Win + R, type cmd, and press Enter.

    • macOS/Linux: Open the "Terminal" application (usually found in Applications > Utilities on macOS, or in your applications menu on Linux).

  2. Check Python Version: In the Command Prompt/Terminal, type:

    python --version

    You should see the installed Python version (e.g., Python 3.10.0). If you get an error like 'python' is not recognized..., then Python was not added to your PATH correctly, and you might need to reinstall or manually configure it.

Step 3: Install Required Python Libraries (tkinter and pyperclip)

Your script relies on tkinter for the graphical user interface and pyperclip for clipboard operations.

  1. tkinter (Tk GUI Toolkit):

    • tkinter is usually included by default with standard Python installations, especially on Windows and macOS.

    • If you are on Linux, you might need to install it separately via your system's package manager. For example:

      • Debian/Ubuntu: sudo apt-get install python3-tk

      • Fedora: sudo dnf install python3-tkinter

    • You can test if tkinter is installed by running python -c "import tkinter; tkinter._test()". A small Tkinter window should appear.

  2. pyperclip:

    • This library enables copying text to and from the clipboard.

    • In your Command Prompt/Terminal, type:

      pip install pyperclip
    • pip is Python's package installer, which comes with Python. This command will download and install pyperclip automatically.

Step 4: Run Your Script

  1. Save Your Script: Save the Python script (e.g., converter.py) to a convenient location on your computer (e.g., your Desktop or a dedicated project folder).

  2. Navigate to Script Directory: In your Command Prompt/Terminal, use the cd (change directory) command to go to the folder where you saved your script.

    • Example (Windows): cd C:\Users\YourUser\Desktop

    • Example (macOS/Linux): cd ~/Desktop

  3. Execute the Script: Once in the correct directory, run your script using Python:

    python converter.py

    The GUI application should now launch. Any error messages will typically appear in the terminal window, which is useful for debugging if the application doesn't start or behaves unexpectedly.

By following these steps, you should have a fully functional Python environment ready to run your KiCad to OpenPnP XML Converter script!

Mike Menci

unread,
Jul 22, 2025, 12:57:06 PMJul 22
to OpenPnP
Thank you !

TMa

unread,
Jul 24, 2025, 6:35:21 AMJul 24
to OpenPnP
Note there is still pending bugfix https://github.com/openpnp/openpnp/pull/1758 to import footprints from Kicad as import pattern uses regex and it is sensitive to visual changes of Kicad footprint definition.
- T.

Dne úterý 22. července 2025 v 18:57:06 UTC+2 uživatel mike....@gmail.com napsal:

Brian Piccioni

unread,
Sep 18, 2025, 11:21:43 AMSep 18
to OpenPnP
Thanks for creating this script. Oddly the 'Import from Kicad Button' Does not seem to do anything so this is great.

If I could make a suggestion (I'd modify your script myself except I do not know python) it would be great if you could select a directory and iterate across the directory, writing out openpnp descriptions. 

This would have a couple of benefits:
1) It would allow users to convert and upload entire KiCad libraries to github https://github.com/openpnp/openpnp/wiki/Package-Definitions

2) In Kicad you can export a library of all modules for a particular design and this would allow batch conversion of this library into openpnp XML.

Again, thanks for the contribution!
Reply all
Reply to author
Forward
0 new messages