← Back to team overview

kicad-lib-committers team mailing list archive

Re: library cleaning - massive attack proposition

 

I've made some code:
https://github.com/michal777/KiCad_Libraries_Cleanup
TODO: debug, improve, add changing lines to 0.15, optional: add searching 3d models It works, but it would be better if somebody could improve it. Finding and replacing is a bit complicated.
If my code is ok and can be accepted I can do the rest.

W dniu 13.11.2014 14:50, Carl Poirier pisze:
I think it sounds good. Could you take an actual .kicad_mod file and edit it by hand to show us exactly what this will give?

I'll take care of the silkscreen and font size with some script myself, so this should be this less to do in yours. I should have the time to do it this weekend.

On Wed, Nov 12, 2014 at 12:25 PM, nnn <nnn4000@xxxxx <mailto:nnn4000@xxxxx>> wrote:

    I mean that name in footprint in .kicad_mod file should be the
    same as name of the file. Now they are not always the same.
    Eg. first line of file:
        Capacitor7x3-5RM5_RevB.kicad_mod
    is:
        module "Capacitors THT RevB:Capacitor7x3-5RM5_RevB" (layer F.Cu)

    I think that if the work with renaming 3d models will be done, we
    can also make other changes. Now there is some mess.
    If user creates new footprint and call it "name_of_footprint", the
    default value of reference is "name_of_footprint" and value is
    "VAL**". If he changes the fields to "some_reference" and
    "some_value" there are two texts on screen that can be confused
    with name of footprint and don't carry any important information,
    because they are replaced by text from netlist. If somebody
    renames the file name to "footprint_file_name", then it's
    inconsistent with name in the file ("name_of_footprint") and it's
    hard to say what the name really is. And there is also some path
    to 3d model and its name: "some_path_3d/some_3d_name".

    So I think we need only name of library and name of footprint
    instead of:
    footprint_file_name, name_of_footprint, some_reference,
    some_value, some_path_3d, some_3d_name

    There will be some work to get libraries from github and merge
    after modification, so I'd like to ask also what do you think
    about changing lines width of silkscreen to 0.15 and changing
    sizes of fonts to some default value.

    If you like the idea and nobody else will write the script, I will
    start writing it in C.


    W dniu 12.11.2014 14:38, Carl Poirier pisze:
    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




    --
    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




Follow ups

References