- Clone KiCad Component Manager to your directory of choosing:
git clone https://github.com/zardini123/KiCad-Component-Manager.git
- Enter cloned repository directory:
cd KiCad-Component-Manager
-
KiCad Component Manager uses
pipenv
for Python version and package management. Go to Pipenv docs for installing pipenv for more information of ways to install pipenv. -
Setup KiCad Component Manager's Python enviroment in cloned repository directory:
pipenv install
In the cloned repository directory, KiCad Component Manager is ran via:
pipenv run python3 -m manager
To add a Component Search Engine part:
- Quit KiCad
- Once symbol and footprint libraries are loaded, they seem to persist until end of session
- Import part by running
add
command - Upgrade symbol libraries to modern format
- Open KiCad
- Enter KiCad Symbol Editor
- If any errors regarding
.lib
files, open files referenced in error in a text editor and fix manually- Open
Preferences > Manage Symbol Libraries...
and press OK to attempt reimport again to see if more errors - Any changes to entires will not be saved until errors are fixed
- Open
- Once errors are fixed (if any), open
Preferences > Manage Symbol Libraries...
and go to "Project Specific Libraries" tab - Find all entries starting with "LEGACY_" in the nickname
- One at a time, click the entry and press "Migrate Libraries" button
- Press OK to save library entries
- Quit KiCad
- Merge migrated library by running
post-migrate
command - Open KiCad and enjoy!
- Go to Footprint Editor
- Search for footprint and select to view
- Click "Edit footprint properties"
- Click tab "3D Models"
- Properly loaded models should have no red error sign left of its entry and should be viewable in "Preview" view.
add
:- @TODO
merge
:- Modifies the new symbol's "Footprint" property to point to its footprint
- @TODO
As of currently, Component Search Engine provides the component in the following KiCad formats:
- Legacy (KiCad < 6.0) (format documentations):
- footprint (.mod)
- symbol (.lib)
- doc lib (.dcm) (cannot find documentation for format)
- Current (KiCad >= 6.0):
- footprint (.kicad_mod) (format documentation)
KiCad seperates data of a component into three seperate systems:
- Footprints are under a .pretty folder, where each component is its own seperate .kicad_mod file
- Each component points to a 3D file via a path in the model expression
- KiCad does not provide tool to migrate .mod to .kicad_mod
- Symbols are under a .kicad_sym file, where multiple components are in one file, seperated syntatically
- KiCad provides "Migrate Libraries" button to migrate each .lib into a .kicad_sym in Preferences > Manage Symbol Libraries...
- Irreversable, one-way conversion.
- KiCad provides "Migrate Libraries" button to migrate each .lib into a .kicad_sym in Preferences > Manage Symbol Libraries...
- 3D files are under a .3dshapes folder, where each component has its own 3d file
- No syntax provided to associate 3D file with its associated footprints
- Association delegated to footprint file (.kicad_mod).
- No syntax provided to associate 3D file with its associated footprints
Once user migrates symbol libraries to current version, merging libraries would be between versions. Therefore to mitigate,
- Manager imports components using old version and merges with existing category library entry (.lib) (nickname "Legacy_Extern_<category>", filename "Legacy_<category>")
- Library set to inactive
Invariants:
- Components of category in current version (.kicad_sym) (prefix "Extern_")
- Components of category in old version (.lib) (inactive) (prefix "Legacy_Extern_")
Then, merge process:
- Ask user to click "Migrate Libraries" button on old version components
Then:
- Continue script
Invariants:
- Components of category in current version (.kicad_sym)
- New components of category in current version (.kicad_sym) (inactive)
Then:
- Use KiUtils to merge the two .kicad_sym's into one
Kandle (KiCAD Component Handler)
KiCad provides a Python API for building plugins and acheiving some level of automation (KiCad 6 Python API). Unfortunately as of currently there is only a Python API for the PCB Editor. Schematic Python API apparently planned for KiCad 7 (source).
KiCad 6.0 PCB Editor uses Python 3.8.2 (verified via its Python scripting console). Due to issues with recent versions of macOS compiler, pipenv is unable to install Python 3.8.2 (pipenv issue). Therefore, this project uses the closest avaliable python version, 3.8.4.
KiCad PCB Editor official documentation on plugin creation/layout
KiCad PCB Editor Python scripting console: Tools > Scripting Console
Get plugin loading issue traceback: Preferences > PCB Editor / Action Plugins, warning symbol bottom of list
Install dev dependencies
pipenv install --dev
Determined provided pip packages by PCB Editor Python enviroment by running in Scripting Console (source):
import pkg_resources
installed_packages = [(d.project_name, d.version) for d in pkg_resources.working_set]
print(installed_packages)
Printed:
[('wxPython', '4.1.1'), ('wheel', '0.38.4'), ('urllib3', '1.26.13'), ('six', '1.16.0'), ('setuptools', '41.2.0'), ('requests', '2.28.1'), ('pip', '19.2.3'), ('idna', '3.4'), ('charset-normalizer', '2.1.1'), ('certifi', '2022.12.7')]