Code Monkey home page Code Monkey logo

kandle's Introduction

Kandle (KiCAD Component Handler)

What is it?

A CLI that handles external components in a KiCad project by automatically importing them into your project symbol, footprint and 3d-model libraries.

It supports files downloaded from several vendors such as:

The CLI will:

  • Handle the unzipping of files downloaded from the above providers.
  • Place symbols, footprints and models in a defined directory structure.
  • Convert KiCad v4 symbols (.lib files) to KiCad v6 symbols (.kicad_sym files).
  • Link a symbol and footprint automatically.
  • Automatically import the symbol *if a symbol library for that component exists (same goes for the footprint)

See it in action here

Video

Or see an example project.

Installation

Download repository

git clone https://github.com/HarveyBates/kandle
cd kandle
mkdir build
cd build
cmake ..
make
make install # (optional, if not you need to add kandle/build/bin to your path)

If you want to permanently add the script to your path here is a tutorial.

Usage

Step 1

In your terminal navigate to your KiCAD project. You want to be in the same directory as your .kicad_pro file. If not you will get an error message saying "KiCad project not found in current working directory. Exiting.".

Step 2

Setup (initialise) the directory structure.

kandle -I

This will result in a directory structure like this:

your_kicad_project/
├─ components/
│  ├─ extern/
│  │  ├─ 3dmodels/
│  │  ├─ footprints/
│  │  ├─ symbols/
│  │  ├─ tmp/ <--- unzipped files will be stored here
├─ fp-info-table
├─ sym-info-table
├─ project.kicad_pcb
├─ project.kicad_pro
├─ project.kicad_sch

Step 3

Download a component from the supported vendors (as above). There is no need to rename the .zip file, unless you would like a alternative name. Kandle will remove "ul_" (from Ultra-Librarian) and "LIB_" (from CSE). It will also replace all - or spaces with _.

Example: If the filename is LIB_PESD 0402-140.zip it will become PESD_0402_140.

Step 4

Execute kandle passing the file you just downloaded and the library the part belongs to.

Example: If the part is an operational amplifier called LM358 stored in your Downloads directory. Your command would look like this: kandle -f Downloads/LM358.zip -l operational_amplifier

kandle -f <your_download_file_name>.zip -l <library_name>

Step 5

Open Eeschema -> Preferences -> Manage Symbol Libraries -> Project Specific Libraries -> Add existing.

Using the above example, you would import the file components/extern/symbols/operational_amplifier.kicad_sym.

Step 6

Open PCBnew -> Preferences -> Manage Footprint Libraries -> Add existing.

Using the above example, you would import the file components/extern/footprints/operational_amplifier.pretty.

Attention Kandle will automatically change default text size of footprint names to 1 with a thickness of 0.15 (KiCAD defaults).

Step 7

Place on your Eeschema schematic. In the above example, you would search for operational_amplifier and then select LM358. The symbol should already be linked to the footprint.

All future symbols and footprints of type operational_amplifier will appear automatically so there is no need to repeat Step 5 again!

Help

KiCAD 3rd Party Component Management Tool
Usage:
  kandle [OPTION...]

  -I, --init          Initialise a KiCAD project with Kandle.
  -L, --list          List existing component libraries.
  -f, --filename arg  Path to zipped (.zip) component file.
  -l, --library arg   Name of the library the component belongs to.
  -h, --help          Help information.

Found a problem

Submit an issue with:

  1. A link to the component (if the issue is related to a component you are trying to import).
  2. A description of the issue that you are facing.

License

This project is MIT licensed, as found in the LICENCE file.

kandle's People

Contributors

harveybates avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kandle's Issues

Core dump with V4 resistor

I tested kandle with an existing small project with three parts. A transistor worked fine but it core dumped with an 0805 SMD resistor at:
Mouser part LINK
The console output was:
ecomer@asrock level-shifter]$ kandle -f /home/ecomer/Downloads/hold/RC0805DR-074K7L.zip -l Resistor_0805 Extracting from: /home/ecomer/Downloads/hold/RC0805DR-074K7L.zip Extracting to: components/extern/tmp/RC0805DR-074K7L Output directory: components/extern/tmp/RC0805DR-074K7L already exists. Converting legacy file. /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1239: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]: Assertion '__pos <= size()' failed. Aborted (core dumped)
BTW Output shows "components/extern/tmp/RC0805DR-074K7L already exists" because it was created by a previous attempt using the same part from digikey.com, which core dumped in the same way.

Compile fails using Manjaro Linux

Compile fails using Manjaro Linux (Arch based). The issue appears to be because your Windows environment that you are apparently using to design kandle is for the newest C++ C17 while my compiler has no or any other C90 includes. My Linux 5.15.114-2-MANJARO is the latest - it is a rolling release. I would love to use kandle but it looks like that isn't currently possible.

First lines of make output:

[ecomer@asrock build]$ make clean
[ecomer@asrock build]$ make
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ecomer/src/kandle/build
[ 12%] Building CXX object CMakeFiles/kandle.dir/src/eschema/config.cpp.o
[ 25%] Building CXX object CMakeFiles/kandle.dir/src/eschema/legacy.cpp.o
In file included from /home/ecomer/src/kandle/include/eschema/legacy.hpp:34,
                 from /home/ecomer/src/kandle/src/eschema/legacy.cpp:25:
/home/ecomer/src/kandle/include/eschema/component.hpp:35:19: error: ‘UINT8_MAX’ was not declared in this scope
   35 |         char name[UINT8_MAX]{};
      |                   ^~~~~~~~~
/home/ecomer/src/kandle/include/eschema/component.hpp:1:1: note: ‘UINT8_MAX’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
  +++ |+#include <cstdint>
```
`

Symbol import breaks with certain componentsearch engine parts

Hi, thanks for writing this tool.

I had an issue using it today where adding certain parts from ComponentSearch Engine would misformat the symbol import.

I haven't root caused it completely, but notably the symbol imports which didn't work seemed to have windows line endings, even though I'm on Linux. Manually running dos2unix on the library and re-shuffling where the symbols got injected fixed things for me. I don't have time to create a full replaceable test case right now, but one of the symbols which broke me is here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.