KLIB (KiCad Library) is a toolkit and libraries for hardware development in KiCad.
Requires python3+
git clone git@gitlab.com:wykys/klib.git
cd klib/scripts
make installThe KLIB contains scripts for easy work with KiCad. You can run all the scripts simply through Makefile. For the correct operation of this scripts, it's important to run the script from the klib/scripts directory!
Lists basic help.
make helpCreates the Python environment needed for some scripts. Clones the official KiCad repository with scripts for checking KLC. Configures KiCad settings. The installation will also make the following scripts available on the system:
klib-update- Updates library tablesklib-upgrade- Updates repositories, configurations and scriptsklib-check-symbol- Check KLC schematic symbolklib-check-footprint- Check KLC footprint
make installThis script automatically sets the environment variables necessary for the KLIB correct function. Extends the ~/.config/kicad/6.0/kicad_common.json file with the following variables:
{
"environment": {
"vars": {
"KLIB_SYMBOL_DIR": "path_to_klib/symbols",
"KLIB_3DMODEL_DIR": "path_to_klib/3dmodels",
"KLIB_FOOTPRINT_DIR": "path_to_klib/footprints"
}
},
}# the first option is to run the command
make
# the second option is to run the command
make update_kicad_varsThis script updates the library tables. It does this by searching for KiCad and KLIB library files (extensions: .kicad_sym and .pretty) and updating the sym-lib-table and fp-lib-table files based on data analysis.
# the first option is to run the command
make update_kicad_lib_tables
# it is equivalent
klib-updateIf it does, it removes the current Python environment in the next step creating a new environment where it installs the packages that are listed in the requirements.txt file.
make venvI use Blender to convert STL to X3D. I have created a Blender API script that will make the necessary transformations before exporting to X3D to correctly display the output in KiCad.
Runs python script in KLIB python environment.
make run script=~/your_script.py- the variables are used in the following ways:
${KLIB_SYMBOL_DIR}/path_to_lib ${KIPRJMOD}is path to current KiCad project folder
- KiCad Library Convention KLC
- KLC Helper Scripts KiCad Library utilities