← Back to team overview

kicad-developers team mailing list archive

Re: PCB API and pcbnew_scripting_helpers

 

On Mon, Jul 11, 2016 at 11:16 PM, Wayne Stambaugh <stambaughw@xxxxxxxxx>
wrote:

> On 7/9/2016 12:45 AM, Cirilo Bernardo wrote:
> > I'm working on a plan to implement a PCB API as a step towards
> > implementing an Export Plugin which uses dynamically loaded
> > code in a manner similar to the current 3D Plugin scheme.
> >
> > As part of the API, a number of basic functions are required:
> > + obtain a pointer to the current BOARD (if any)
> > + load a BOARD
> > + save a BOARD
> > + create a new BOARD
> > + close the current BOARD
>
> Are you talking about changing the Pcbnew IO_MGR code to use dynamically
> loaded plugins instead of compiled in plugins?  If so, you must
> implement the entire PLUGIN API which includes handling footprint
> libraries not just board files.  Please do not change this API as it is
> used extensively throughout Pcbnew.  There is no reason to create a
> separate API for python, you can already access the PLUGIN API with
> Python.  I just opened a Python console and loaded a board file using
> the IO_MGR and PLUGIN objects.
>
>
No, I have no plans to make any changes to the IO_MGR. I'll have a
look at that class again. If anything a PCB API dynamic plugin should
make use of such a class rather than supplant it.  What I'm talking
about is an API for a dynamic plugin to use to inspect board data, which
is the minimum required to implement an MCAD exporter plugin, and later
perhaps even manipulate board data. If anything this PCB API would
provide wrappers to the IO_MGR and so on; there would be no alterations.


> >
> > I noticed that the pcbner_scripting_helpers.{cpp,h} implement
> > the LOAD/SAVE part for use by the Python interface. Since
> > these functions will also be required by a PCB API, could
> > we rework those files so that they are always compiled into
> > kicad? I would like to ensure those functions are always
> > compiled and gradually add to them to create a base from
> > which to start the PCB API.
>
> I rather you used the existing PLUGIN API.  I'm not even sure why this
> code exists.  Why do we need multiple board and footprint library
> handlers?  I'm a bit confused as to why this is even necessary.
>
>
I think  that code exists to provide a wrapper for Python to load a
board or obtain a handle to the board. It basically exposes some
KiCad data as global variables and passes it on to Python.  I have
always considered that sort of thing as a flaw in the data structure
or program design - why is it seemingly impossible to obtain some
information without adding kludges like pcbnew_scripting_helpers
which expose data as globals?

- Cirilo


>
> > - Cirilo
> >
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>

References