← Back to team overview

kicad-developers team mailing list archive

the future of plugins

 

Hi folks,

 Since the 3d_initial_merge introduces a class to manage the generic
boilerplate of plugins and the new 3D plugins seem to be stable (no reports
of problems for quite a few weeks now) I had a quick look at the KiCad
code to see what might be involved in implementing Import/Export
plugins. As with the 3D plugins there are 3 principal components here:

1. the plugin API : any plugins of PCB Import/Export class must implement
this API
2. the plugin manager : part of KiCad, this component is responsible for
the discovery and loading of PCB Import/Export plugins
3. PCB API : the API exposed by kicad for inspecting, creating, and
manipulating boards and related entities

(1) is almost trivial and I imagine no more than 20 function calls in all
need to be implemented

(2) shouldn't be terribly difficult, perhaps only slightly more difficult
than
its 3D counterpart since this plugin manager would need to dynamically
create entries in the File Export menu in addition to the requirements to
discover and load plugins

(3) is an enormous task and not something anyone can complete in one
step.  Fortuitously the IDF exporter requires the smallest set of API
functions in order to implement as a plugin and any IGES or STEP
exporters will have exactly the same requirements as the IDF exporter.

So I would propose that after (if?) merging the 3d_initial_merge branch
I could begin an implementation of (1), (2), (3) suitable for IDF export.
In the short term the PCB plugin manager will contain extra code to
provide access to existing Import/Export functions as they are - that
is, the manager will basically simply relieve the PCB_EDIT_FRAME of its
responsibility to dispatch the Import/Export events even though those
particular Import/Export functions are not (yet) implemented in
plugins and also provide the dynamic manipulation of the File Import/
Export menus to support genuine plugins.

The next step would be to implement a plugin version of the IDF
exporter and to demonstrate that it works. From there I can then
add an IGES exporter and also have a look at a STEP exporter.
This scheme will give us the long desired MCAD export capability
with the least amount of work and at this point I would consider
the branch ready for polishing up and merging.

Once we have the initial merge of the PCB Plugin then we can
continue work extending the API in (3)  and eventually reimplementing
the remaining Import/Export functions as plugins - this should
improve code maintainability even though it's no small feat and it
doesn't add any functionality.  Going through this exercise would
also expand the API (3) to the point where we can implement
scripting of that API to have a more intuitive scripting environment.

Any comments/suggestions?

- Cirilo