I did some new implementation for kicad-python: Building a proposal for an (official) high level python API
Basically, it’s a preliminary implementation which shows how footprint plugins could be handled. I will try to extend it to BOM-scripts, Action Plugins,… in the future as well to have all those things in a similar structure.
What’s different to the already present footprint generator? Well, it now supports CLI scripting which is very important for library management like it’s done in the official library. Actually, this work should replace my footprint generator framework https://github.com/pointhi/kicad-footprint-generator in long-term.
My current idea would be to have a new kicad-scripting repository with some structure like:
- CMakeLists.txt
- scripts
|- footprint_wizard_package_dip.py
|- footprint_wizard_package_sip.py
|- ...
- library
|- Package_DIP
|- CMakeLists.txt
|- package_dip.yml
|- package_dip_handsoldering.yml
|- Package_SIP
|- CMakeLists.txt
|- package_sip_sharp.yml
|- ...
- specs
|- KLC.yaml
|- IPC.yaml
In the scripts repository, all wizard scripts would be located. They can be used in the footprint wizard to give users the possibility to create new KLC compatible footprints from scratch using the GUI.
In the library folder, on the other hand, we have the same directory structure as in the official one. They contain footprint specification files like the ones which are heavily used in my kicad-footprint-generator project. The cmake scripts connect the specification files with the scripts together and would allow us to generate a library from scratch. If possible it should also support generating 3D-Models (I haven’t looked into this yet)
The specs folder would contain some definition files to alter the behaviour of the scripts. Namely naming convention, line width, courtyard distance,… I didn’t implement this yet, especially because I’m still not sure how those files should look like in the end. https://github.com/pointhi/kicad-footprint-generator/tree/master/scripts/tools/global_config_files shows how this stuff is currently handled in some scripts. Ideally, those definitions would change the default parameters of the wizard to avoid boilerplate code.
You can find the current wizard example in my kicad-python repo. You notice many TODO statements which should make it clear it is not ready for production yet. But it is able to execute and returns a footprint with ref and value.
I would like to know what you think about this proposal. Furthermore, I would like to discuss some ideas how the python and yaml files should look like in the future. That’s the reason why the current stuff is so hacky. I would like to create some nice specification first and then do the real implementation.