← Back to team overview

kicad-developers team mailing list archive

Re: PLUGIN::Footprint*() from python

 

Of course, I will be very happy to help on that, if you point me to the
"lib table" branch.

The needed functions are here:
http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/view/head:/pcbnew/scripting/module.i


def GetPluginForPath(lpath):
        return IO_MGR.PluginFind(IO_MGR.LEGACY)
	def FootprintEnumerate(lpath):
        plug = GetPluginForPath(lpath)
        return plug.FootprintEnumerate(lpath)
	def FootprintLoad(lpath,name):
        plug = GetPluginForPath(lpath)
        return plug.FootprintLoad(lpath,name)
	def FootprintSave(lpath,module):
	plug = GetPluginForPath(lpath)
        return plug.FootprintSave(lpath,module)
	def FootprintDelete(lpath,name):
        plug = GetPluginForPath(lpath)
        plug.FootprintDelete(lpath,name)
	def FootprintLibCreate(lpath):
        plug = GetPluginForPath(lpath)
        plug.FootprintLibCreate(lpath)
	def FootprintLibDelete(lpath):
        plug = GetPluginForPath(lpath)
        plug.FootprintLibDelete(lpath)
	def FootprintIsWritable(lpath):
        plug = GetPluginForPath(lpath)
        plug.FootprintLibIsWritable(lpath)

    and they should be available from pcbnew.* :

it must be something like (totally untested):

import pcbnew

list_of_parts = pcbnew.FootprintEnumerate("file.mod")

for part_id in list_of_parts:
    module = FootprintLoad("file.mod",part_id)
    FootprintSave("new_path",part_id)


problems will arise, and bugs will need to be hunted :-)

Greetings :-)


2012/10/19 Dick Hollenbeck <dick@xxxxxxxxxxx>

> Hi Miguel,
>
> I would like to be able to instantiate to PLUGINs simultaneously in a
> script, one of type
> LEGACY, and the second of type KICAD.
>
> Then I would like to copy all the footprints from one plugin to the other,
> thereby doing a
> conversion of the entire library behind the LEGACY plugin into the library
> behind the
> KICAD plugin.
>
> Is this kind of script fu something you could help us with?
>
> Maybe it could take two "library paths" on the command line, old and new.
>
> FYI, a "library path" in the context of the new KICAD format is now a
> directory, whereas a
> "library path" in the context of the LEGACY plugin is an actual *.mod
> file, but I think
> the API hides this abstractly.
>
>
> Thanks for any help you can offer,
>
> Dick
>
>
> P.S. Wayne and I are currently collaborating on the branch which is being
> used to add the
> "lib table" support.  So the time at which this script could be very
> useful is
> approaching.  I envision running it one time on all the package supplied
> footprint
> libraries, and that may be the end of its utility for the most part.
>
>
>
>
>
>
>
> _______________________________________________
> 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
>



-- 

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 636 52 25 69
skype: ajoajoajo

Follow ups

References