Hi Michal,
Great initiative there. I do think placing the 3D packages under
folders the same name as the .pretty ones is a good idea.
In your steps, I'm not sure to understand why you change the module
name to FOOTPRINT1. Can you elaborate more?
Carl
On Tue, Nov 11, 2014 at 5:16 AM, nnn <nnn4000@xxxxx
<mailto:nnn4000@xxxxx>> wrote:
Hi all,
I'd like to ask you about idea of cleaning the mess that we have
in footprints and 3d models. I think that it would be good to
write some script which could make the job. It would be much
easier to work with 3d models if their names are the same as names
of footprints, and they are put into folders named the same as
*.pretty libraries. I'd suggest the following algorithm:
//preparation:
1. clone kicad-library and move kicad-library/modules/packages3d/
to ~/KiCad_Libraries/packages3d_bck/
2. clone all *.pretty libraries to ~/KiCad_Libraries/Pretty_bck/
3. create new empty folders: ~/KiCad_Libraries/packages3d/ and
~/KiCad_Libraries/Pretty/
//run the script:
4. open first footprint from first library
(~/KiCad_Libraries/Pretty_bck/LIBRARYNAME1.pretty/FOOTPRINT1.kicad_mod)
5. change MODULE_NAME1 (first line, "(module MODULE_NAME1...") to
FOOTPRINT1,
6. optional: change reference to FOOTPRINT1, change value to
VAL**, change all silkscreen lines width to 0.15, change text size
of referece and value to some default
7. read 3d model name (after keyword model: "model
SOME_PATH/MODEL_NAME1.wrl")
8. check if the model exists in
~/KiCad_Libraries/packages3d_bck/SOME_PATH/MODEL_NAME1.wrl
9. if the model exists, copy
~/KiCad_Libraries/packages3d_bck/SOME_PATH/MODEL_NAME1.wrl to
~/KiCad_Libraries/packages3d/LIBRARYNAME1/FOOTPRINT1.wrl (in the
same way copy corresponding *.wings file), change in file
FOOTPRINT1.kicad_mod "model SOME_PATH/MODEL_NAME1.wrl" to "model
LIBRARYNAME1/FOOTPRINT1.wrl
10. if the model not exist, write the information in log file:
~/KiCad_Libraries/BROKEN_LINK_LOG
11. optional: if the model not exist, search MODEL_NAME1.wrl in
~/KiCad_Libraries/packages3d_bck/ with subdirectories and if
found, write proper information to the log file:
~/KiCad_Libraries/REPAIRED_LINK_LOG, then copy path to found model
~/KiCad_Libraries/packages3d_bck/SOME_PATH/FOUND_MODEL_NAME1.wrl
to ~/KiCad_Libraries/packages3d/LIBRARYNAME1/FOOTPRINT1.wrl and
change in FOOTPRINT1.kicad_mod "model SOME_PATH/MODEL_NAME1.wrl"
to "model LIBRARYNAME1/FOOTPRINT1.wrl
12. save changed
~/KiCad_Libraries/Pretty_bck/LIBRARYNAME1.pretty/FOOTPRINT1.kicad_mod
to ~/KiCad_Libraries/Pretty/LIBRARYNAME1.pretty/FOOTPRINT1.kicad_mod
13. repeat steps from 4. to 13. for next footprint in the same or
next library
14. compare ~/KiCad_Libraries/packages3d_bck/ with
~/KiCad_Libraries/packages3d/, find unused 3d models and move them
to ~/KiCad_Libraries/packages3d/unused/
//finish the work:
15. check if all is ok, check log files
16. pull and merge everything
After that, the mess will decrease. Some duplicates will be
generated, but it would be easier to clean up the rest.
Similar code could be made to check consistency of libraries in
future.
I can try to write it in c, but I'm not programmer, so it will
take me some time do it. It would be great if somebody more
experienced will help me to implement it in c or do it in some
higher-level language.
What do you think about this idea?
Michał Stec
--
Mailing list: https://launchpad.net/~kicad-lib-committers
<https://launchpad.net/%7Ekicad-lib-committers>
Post to : kicad-lib-committers@xxxxxxxxxxxxxxxxxxx
<mailto:kicad-lib-committers@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~kicad-lib-committers
<https://launchpad.net/%7Ekicad-lib-committers>
More help : https://help.launchpad.net/ListHelp