Python script to check for default fields?

Is there some python script that checks if the symbol on the libraries has all the fields from a given list?

In danger of stating the obvious:

Eeschema does not have a scripting interface yet, so it would be an external script.

In python, comparing “some object” with a list is maybe 3 lines of code? So the remaining is loading a KiCad symbol library into memory so it can be manipulated by python. Maybe SKiDL can do that. It’s main goal is to generate a netlist from a python script, and part of that is creating components, but I’m not sure if it creates them out of empty bits, or loads them from existing libraries.

I had a short peek at SKiDL’s source code. It does something with paths and libraries, although the path for the default schematic symbol libraries is not in the list:

def get_kicad_lib_tbl_dir():
    """Get the path to where the global fp-lib-table file is found."""

    paths = (
        "$HOME/.config/kicad",
        "~/.config/kicad",
        "%APPDATA%/kicad",
        "$HOME/Library/Preferences/kicad",
        "~/Library/Preferences/kicad",
    )
    for path in paths:
        path = os.path.normpath(os.path.expanduser(os.path.expandvars(path)))
        if os.path.lexists(path):
            return path
    return ""

Reading the SKiDL user manual is probably a better way, or maybe someone else can chime in here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.