OK, I got a footprint library to convert from legacy to kicad format using the attached command line python script. It ran nicely, and quickly, without a fuss once I get it setup correctly.
Procedure I used, which is perhaps not optimal, but is one that worked: (I'm open to suggestions on improvement.) 1) Build target _pcbnew after enabling scripting in cmake. $ make _pcbnew 2) Changed dir to pcbnew $ cd pcbnew $ pwd build/pcbnew 3) Entered following command line, script takes to arguments: oldLibPath & newLibPath $ PYTHONPATH=. ../lib_convert.py /usr/local/share/kicad/modules/smd_dil.mod /tmp/smd_dil 4) inspect one footprint found in new librarypath /tmp/smd_dil $ less /tmp/smd_dil/msoic-10.kicad_mod Attached is one of the converted footprints, *.kicad_mod Observations: a) Layernames should be in English always (in a footprint, not a board). b) The old footprint was deci-mils, the new one is mm. c) The next thing I notice is the ugyly timestamps on the fp_lines. Wayne or JP, do we need those time stamps on mere lines?
#!/usr/bin/python from __future__ import print_function from pcbnew import * import sys if len( sys.argv ) < 3 : print( "usage: script oldLibraryPath newLibraryPat" ) sys.exit(1) # 2 libraryPaths. One is a file, one is a new directory, but that difference # is abstracted into the notion of a "library path", so you can forget that you # now know that secret. old = sys.argv[1] new = sys.argv[2] legacy = IO_MGR.PluginFind( IO_MGR.LEGACY ) kicad = IO_MGR.PluginFind( IO_MGR.KICAD ) try: kicad.FootprintLibDelete( new ) except: None # ignore, new may not exist if first run kicad.FootprintLibCreate( new ) list_of_parts = legacy.FootprintEnumerate( old ) for part_id in list_of_parts: module = FootprintLoad( old, part_id ) kicad.FootprintSave( new, module )
(module msoic-10 (layer Front) (tedit 49EA0D66) (tstamp 0) (at 0 0) (descr MSOIC-10) (fp_text reference MSOIC-10 (at 0 -0.29972) (layer SilkS_Front) (effects (font (size 0.24892 0.24892) (thickness 0.06096))) ) (fp_text value U*** (at 0 0.29972) (layer SilkS_Front) (effects (font (size 0.24892 0.24892) (thickness 0.0508))) ) (fp_line (start -1.016 -2.413) (end -1.016 -1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21A7)) (fp_line (start -0.508 -2.413) (end -0.508 -1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21A8)) (fp_line (start 0 -2.413) (end 0 -1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21A9)) (fp_line (start 0.4826 -2.413) (end 0.4826 -1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21AA)) (fp_line (start 1.016 -2.413) (end 1.016 -1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21AB)) (fp_line (start 1.016 2.413) (end 1.016 1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21AC)) (fp_line (start 0.508 2.413) (end 0.508 1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21AD)) (fp_line (start 0 2.413) (end 0 1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21AE)) (fp_line (start -0.508 2.413) (end -0.508 1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21AF)) (fp_line (start -0.9906 2.413) (end -0.9906 1.524) (layer SilkS_Front) (width 0.127) (tstamp 509F21B0)) (fp_circle (center -0.89916 0.9017) (end -1.09982 1.09982) (layer SilkS_Front) (width 0.127) (tstamp 509F21B1)) (fp_line (start 1.50114 -1.50114) (end -1.50114 -1.50114) (layer SilkS_Front) (width 0.127) (tstamp 509F21B2)) (fp_line (start -1.50114 -1.50114) (end -1.50114 1.50114) (layer SilkS_Front) (width 0.127) (tstamp 509F21B3)) (fp_line (start -1.50114 1.50114) (end 1.50114 1.50114) (layer SilkS_Front) (width 0.127) (tstamp 509F21B4)) (fp_line (start 1.50114 1.50114) (end 1.50114 -1.50114) (layer SilkS_Front) (width 0.127) (tstamp 509F21B5)) (pad 1 smd rect (at -1.00076 2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 2 smd rect (at -0.50038 2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 3 smd rect (at 0 2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 4 smd rect (at 0.50038 2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 5 smd rect (at 1.00076 2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 6 smd rect (at 1.00076 -2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 7 smd rect (at 0.50038 -2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 8 smd rect (at 0 -2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 9 smd rect (at -0.50038 -2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (pad 10 smd rect (at -1.00076 -2.30124) (size 0.29972 1.02108) (layers Front SoldP_Front Mask_Front) ) (model smd/smd_dil/msoic-10.wrl (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) ) )
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp