KiMotor - Parametric PCB motors in KiCad
Notes on a proof-of-concept KiCad plugin to generate parametric PCB stators for axial-flux electric motors.
Current status
The plugin currently allows the customization of few main mechanical and electrical parameters. The plugin is a POC of possibly good things to come. It is still a far cry from being reliable for the day to day use (see issues) but you can have a look at the code and/or download it from GitHub.
Developer notes for KiCad plugins
Pcbnew board file format and API
Locate plugin folders
> import pcbnew; print(pcbnew.PLUGIN_DIRECTORIES_SEARCH)
/app/share/kicad/scripting
/app/share/kicad/scripting/plugins
/home/stefano/.var/app/org.kicad.KiCad/config/kicad/6.0/scripting
/home/stefano/.var/app/org.kicad.KiCad/config/kicad/6.0/scripting/plugins
/home/stefano/.var/app/org.kicad.KiCad/data/kicad/6.0/scripting
/home/stefano/.var/app/org.kicad.KiCad/data/kicad/6.0/scripting/plugins
/home/stefano/.var/app/org.kicad.KiCad/data/kicad/6.0/3rdparty/plugins
I’ve found a very different structure from the ones described in the official documentation. This is probably due to the fact I’ve install KiCad from snap.
Important details on plugins
ATTENTION if the plugin file is in a subfolder the __init__.py file is needed (i.e. it is a proper Python package)
References
KiCad Plugins official documentation with hints on standard folders for plugin