An open API service indexing awesome lists of open source software.

https://github.com/steffen-w/import-lib-kicad-plugin

Helps to import KiCad component libraries imported from ultralibrarian and snapeda zipfiles.
https://github.com/steffen-w/import-lib-kicad-plugin

kicad library plugin samacsys snapeda ultralibrarian

Last synced: 2 months ago
JSON representation

Helps to import KiCad component libraries imported from ultralibrarian and snapeda zipfiles.

Awesome Lists containing this project

README

          

![Static Badge](https://img.shields.io/badge/Supports_KiCad-v6%2C_v7%2C_v8%2C_v9-%23314cb0)
![Static Badge](https://img.shields.io/badge/Supports-Windows%2C_Mac%2C_Linux-Green)
![Static Badge](https://img.shields.io/badge/Python-3.9_%7C_3.10_%7C_3.11_%7C_3.12-blue?logo=python&logoColor=white)

[![Static Badge]()](https://componentsearchengine.com/)
[![Static Badge]()](https://www.snapeda.com/home/)
[![Static Badge](https://img.shields.io/badge/UltraLibrarian-Works-229954)](https://app.ultralibrarian.com/search)
[![Static Badge](https://img.shields.io/badge/Octopart-Works-52be80)](https://octopart.com/)
[![Static Badge](https://img.shields.io/badge/LCSC--EasyEDA-Works-008000)](https://www.lcsc.com/)

[![GitHub Release](https://img.shields.io/github/release/Steffen-W/Import-LIB-KiCad-Plugin.svg)](https://github.com/Steffen-W/Import-LIB-KiCad-Plugin/releases/latest)
[![Nightly Build](https://img.shields.io/badge/nightly-download-orange)](https://github.com/Steffen-W/Import-LIB-KiCad-Plugin/releases/tag/nightly)
[![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/Steffen-W/Import-LIB-KiCad-Plugin/total)](https://github.com/Steffen-W/Import-LIB-KiCad-Plugin/releases/latest/download/Import-LIB-KiCad-Plugin.zip)

# KiCad Import-LIB-KiCad-Plugin ![icon](plugins/icon_small.png)

This plugin allows importing downloaded libraries from the platforms [Octopart](https://octopart.com/), [Samacsys](https://componentsearchengine.com/), [Ultralibrarian](https://app.ultralibrarian.com/search), [Snapeda](https://www.snapeda.com/home/) and [EasyEDA](https://www.lcsc.com/). It can import symbols, footprints, descriptions, and if available, 3D files. Normally, when you select the imported symbol in KiCad, the appropriate footprint and the 3D file should also be linked. Provided, of course, that the libraries have been included as specified below.

[![SC2 Video](doc/demo.gif)](https://youtu.be/VrWPPHtCovQ)

[YouTube - Instructions for installation and use](https://youtu.be/BYIKjCs1qKQ)

## Installation

Install the plugin easily through KiCad's **Plugin And Content Manager**. Select ![icon](plugins/icon_small.png) **Import-LIB-KiCad-Plugin** in the Plugins tab, press **Install** and then **Apply Pending Changes**.

You can also download the latest version [here](https://github.com/Steffen-W/Import-LIB-KiCad-Plugin/releases/latest/download/Import-LIB-KiCad-Plugin.zip) and install it via **KiCad** -> **Plugin And Content Manager** -> **Install from File...** -> select **Import-LIB-KiCad-Plugin.zip** and import.

## Use of the application

The import window is accessible in the **PCB Editor** -> **Tools** -> **External Plugins** -> **impartGUI**

grafik

The libraries to import must be located in the folder specified as **Folder of the library** to import. After pressing Start, the libraries will be imported into the specified folder (**Library save location**).

**New:** You can also drag and drop ZIP files directly into the text area for instant import without setting up folder monitoring.

By default, each source gets its own library (e.g. `Samacsys.kicad_sym`, `Snapeda.kicad_sym`). Enable **single lib name** and enter a name to merge all imports into one library file instead.

Provided that the paths have been [added correctly in KiCad](#including-the-imported-libraries-in-kicad), the parts can be used immediately in KiCad. If the libraries have not been imported correctly, a warning will indicate this.

## Including the imported libraries in KiCad

⚠️ **IMPORTANT:** Before using the plugin, you must manually configure the library paths in KiCad. The automatic configuration option may not work reliably in all cases.

**Step 1: Configure Environment Variable**

**Preferences** -> **Configure paths** -> **Environment Variables** -> Add the following entry

| Name | Path |
| --------------- | --------------------------- |
| KICAD_3RD_PARTY | **YourLibraryFolder**/KiCad |

**Step 2: Add Symbol Libraries**

**Preferences** -> **Manage Symbol Libraries** -> **Global Libraries** -> Add the following entries

**Note:** Add only the libraries you plan to use. Errors will appear if you add libraries that don't exist yet - they will be created automatically when you import your first component from that source.

| Active | Visible | Nickname | Library Path | Library Format |
| ------------------ | ------------------ | -------------- | ------------------------------------------- | -------------- |
| :heavy_check_mark: | :heavy_check_mark: | Samacsys | ${KICAD_3RD_PARTY}/Samacsys.kicad_sym | KiCad |
| :heavy_check_mark: | :heavy_check_mark: | Snapeda | ${KICAD_3RD_PARTY}/Snapeda.kicad_sym | KiCad |
| :heavy_check_mark: | :heavy_check_mark: | UltraLibrarian | ${KICAD_3RD_PARTY}/UltraLibrarian.kicad_sym | KiCad |
| :heavy_check_mark: | :heavy_check_mark: | EasyEDA | ${KICAD_3RD_PARTY}/EasyEDA.kicad_sym | KiCad |

**Step 3: Add Footprint Libraries**

**Preferences** -> **Manage Footprint Libraries** -> **Global Libraries** -> Add the following entries

**Note:** Add only the libraries you plan to use. As with symbol libraries, errors will appear until you import your first component.

| Active | Nickname | Library Path | Library Format |
| ------------------ | -------------- | ---------------------------------------- | -------------- |
| :heavy_check_mark: | Samacsys | ${KICAD_3RD_PARTY}/Samacsys.pretty | KiCad |
| :heavy_check_mark: | Snapeda | ${KICAD_3RD_PARTY}/Snapeda.pretty | KiCad |
| :heavy_check_mark: | UltraLibrarian | ${KICAD_3RD_PARTY}/UltraLibrarian.pretty | KiCad |
| :heavy_check_mark: | EasyEDA | ${KICAD_3RD_PARTY}/EasyEDA.pretty | KiCad |

**Step 4: Restart KiCad**

After adding the library paths, **restart KiCad** to ensure all settings are properly loaded.

---

**About the "auto KiCad setting" option:** While the plugin offers an automatic configuration option, it may not work reliably in all KiCad versions or configurations. If you encounter errors like "Failed to add library automatically", follow the manual steps above instead.

## CLI Support

The import process can also be done completely without the GUI. Run from the `plugins` directory:

```bash
cd plugins
python -m KiCadImport -h
```

```bash
usage: __main__.py [-h] (--download-folder DOWNLOAD_FOLDER | --download-file DOWNLOAD_FILE | --easyeda EASYEDA)
--lib-folder LIB_FOLDER [--overwrite-if-exists] [--path-variable PATH_VARIABLE]
[--prefer-step] [--lib-name LIB_NAME]

Import KiCad libraries from a file or folder.

options:
-h, --help show this help message and exit
--download-folder DOWNLOAD_FOLDER
Path to the folder with the zip files to be imported.
--download-file DOWNLOAD_FILE
Path to the zip file to import.
--easyeda EASYEDA Import easyeda part. example: C2040
--lib-folder LIB_FOLDER
Destination folder for the imported KiCad files.
--overwrite-if-exists
Overwrite existing files if they already exist
--path-variable PATH_VARIABLE
Example: if only project-specific '${KIPRJMOD}' standard is '${KICAD_3RD_PARTY}'
--prefer-step Use STEP instead of WRL as the 3D model reference in footprints
(falls back to WRL if no STEP available)
--lib-name LIB_NAME Use a custom library name for all imports
(e.g., 'Custom' instead of Samacsys/Snapeda/EasyEDA)
```

## KiCad IPC API (Recommended)

The **KiCad IPC API** is the modern and recommended way to run this plugin. It provides automatic dependency management and better performance compared to the fallback solution.

**To activate the KiCad IPC API:**

1. **KiCad** -> **Settings** -> **Plugins** -> **Enable Plugin System**
2. Check **Enable KiCad API** option
3. Restart KiCad

![KiCad API Settings](doc/kicad_api_settings.png)

**Benefits of using the KiCad IPC API:**

- Automatic dependency installation in isolated environment
- Faster startup and execution
- Better integration with KiCad
- No manual setup required

**Plugin access with IPC API:**

- **PCB Editor** -> **Tools** -> **External Plugins** -> **impartGUI (IPC API)**
- **Schematic Editor** -> **Tools** -> **External Plugins** -> **impartGUI (IPC API)**

## Fallback Solution (pcbnew)

If the **KiCad IPC API** is not available or activated, the plugin will automatically use a fallback solution. The KiCad API handles dependency installation in its own virtual environment automatically, while the fallback solution requires manual setup.

**To activate the KiCad IPC API (recommended):**
**KiCad** -> **Settings** -> **Plugins** -> **Activate KiCad API**

## Warranty

**None. Zero. Zilch. Use at your own risk**, and please be sure to use git or some other means of backing up/reverting changes caused by this script. This script will modify existing lib, dcm, footprint or 3D model files. It is your responsibility to back them up or have a way to revert changes should you inadvertently mess something up using this tool.

Please write an issues if an import does not work as requested.

## FAQ

**Do I have to manually create a library that does not yet exist before using the plugin?**
No, you do not need to create a file manually. Your only task is to download your desired part from the internet and start the import process with the plugin.

**Where can I save the library?**
It is possible to save the files in any place on your PC where you have read and write permissions.
It is also possible to store the files on network drives or cloud storage to share the library with others.
In the libraries relative paths are used, the absolute path is not considered.

**Can I change the storage location?**
Yes, this is of course always possible. But you should keep in mind that the existing libraries will not be moved automatically. You would have to do that yourself if necessary.

**If I import from one source, do I have to stay with that source, or can I import from all sources?**
No, you can import from all sources freely. Each source gets its own library (e.g. `Samacsys.kicad_sym`, `Snapeda.kicad_sym`, `Octopart.kicad_sym`, `UltraLibrarian.kicad_sym`, `EasyEDA.kicad_sym`). If you enable **single lib name**, all imports are merged into one library instead.

### General KiCad Questions

**I have entered a library in the settings in KiCad that does not exist at this time, what happens?**
You get a message that this library does not exist. Nothing more. As soon as it exists, it can be accessed.

**Can I remove a library from the settings?**
Yes, you can always do that. The libraries are neither deleted nor edited in any way. They are just not included.

## Todo List

- [x] Drag and drop support for ZIP files
- [x] add as local project Lib
- [x] plugin in schematic windows
- [x] Add digikey support
- [x] Reloading the dependency pydantic for [uPesy/easyeda2kicad.py](https://github.com/uPesy/easyeda2kicad.py)
- [x] Updating the library before an import `kicad-cli sym upgrade`
- [x] Updating the footprint library `kicad-cli fp upgrade *.pretty`
- [x] add [jlcpcb parts](https://jlcpcb.com/parts) to import (integrate [uPesy/easyeda2kicad.py](https://github.com/uPesy/easyeda2kicad.py))
- [x] Automatic background import
- [x] Test on a Mac
- [x] Testing all library formats
- [x] Using the new KiCad format
- [x] Possibility of automatic KiCad settings adjustment

If you notice an error then please write me an issue. If you want to change the GUI or the functionality, I am also open for ideas.

[![Create Issue](https://img.shields.io/badge/Create%20Issue-blue.svg)](https://github.com/Steffen-W/Import-LIB-KiCad-Plugin/issues/new)

Support via Ko-fi

## Development Setup

### Building the KiCad Plugin Package

```bash
# Clone repository with submodules
git clone --recurse-submodules https://github.com/Steffen-W/Import-LIB-KiCad-Plugin.git
cd Import-LIB-KiCad-Plugin

# If you already cloned without --recurse-submodules, initialize submodules:
git submodule update --init

# Update to latest changes (including submodules)
git pull --recurse-submodules
git submodule update --remote --merge

# Generate KiCad plugin ZIP file (Linux/macOS/Windows Git Bash)
./generate_zip.sh
```

**The `generate_zip.sh` script:**

- Updates version in `metadata.json` with current date
- Packages only essential files (excludes dev files, caches, etc.)
- Creates `Import-LIB-KiCad-Plugin.zip` ready for KiCad Plugin Manager

## Many thanks to

[wexi with impart](https://github.com/wexi/impart) and [topherbuckley](https://github.com/topherbuckley/kicad_remote_import) for the code on which the GUI is based.
I would also like to thank [uPesy](https://github.com/uPesy) for enabling the import of [EasyEDA](https://www.lcsc.com/) through his python project [uPesy/easyeda2kicad.py](https://github.com/uPesy/easyeda2kicad.py) (AGPL-3.0 license).
I also thank the people who helped me find the errors in the code.