skidl.schlib module¶
Handles schematic libraries for various ECAD tools.
- class skidl.schlib.SchLib(filename=None, tool=None, lib_section=None, **attribs)[source]¶
Bases:
object
A class for storing parts from a schematic component library file.
- filename¶
The name of the file from which the parts were read.
- parts¶
The list of parts (composed of Part objects).
- Parameters:
filename – The name of the library file.
tool – The format of the library file (e.g., KICAD).
lib_section – The section of the library to access (for SPICE, only).
- Keyword Arguments:
attribs – Key/value pairs of attributes to add to the library.
- export(libname, file_=None, tool=None)[source]¶
Export a library into a file.
- Parameters:
libname – A string containing the name of the library.
file – The file the library will be exported to. It can either be a file object or a string or None. If None, the file will be the same as the library name with the library suffix appended.
tool – The CAD tool library format to be used. Currently, this can only be SKIDL.
- get_parts(use_backup_lib=True, **criteria)[source]¶
Return parts from a library that match all the given criteria.
- Keyword Arguments:
criteria – One or more keyword-argument pairs. The keyword specifies the attribute name while the argument contains the desired value of the attribute.
- Returns:
A list of Parts that match all the criteria.
- get_parts_by_name(name, be_thorough=True, allow_multiples=False, allow_failure=False, partial_parse=False)[source]¶
Return a Part with the given name or alias from the part list.
- Parameters:
name – The part name or alias to search for in the library.
be_thorough – Do thorough search, not just simple string matching.
allow_multiples – If true, return a list of parts matching the name. If false, return only the first matching part and issue a warning if there were more than one.
allow_failure – Return None if no matches found. Issue no errors/warnings.
partial_parse – If true, don’t fully parse any parts that are found.
- Returns:
A list of Parts that match all the criteria.