skidl.skidl module¶
SKiDL: A Python-Based Schematic Design Language
This module is the main entry point for SKiDL and provides global functions and configuration for creating electronic circuit designs programmatically. It initializes the default circuit and provides functions that operate on it.
- skidl.skidl.ERC(*args, **kwargs)¶
Perform Electrical Rule Checking on the circuit.
This method runs both the class-wide ERC functions and any local ERC functions defined for this circuit. It checks for issues like unconnected pins, pin type conflicts, etc.
- Parameters:
*args – Arguments to pass to the ERC functions.
**kwargs – Keyword arguments to pass to the ERC functions.
- skidl.skidl.backup_parts()¶
Save all parts in the circuit as a SKiDL library file.
This creates a backup library that can be used to restore the parts in the circuit.
- Parameters:
file (str or file object, optional) – File to write the library to. If None, a standard library file will be used.
- skidl.skidl.empty_footprint_handler(part)¶
Handle the situation of a Part with no footprint when generating netlist/PCB.
- Parameters:
part (Part) – The part with no footprint.
Note
By default, this function logs an error message if the footprint is missing. Override this function if you want to try and set some default footprint for particular types of parts (such as using an 0805 footprint for a resistor).
- skidl.skidl.erc_assert(fail_msg='FAILED', severity=ERROR)¶
Add an ERC assertion to this object or its class.
- Parameters:
assertion – A string containing a Python expression that should evaluate to True.
fail_msg – Message to display if assertion fails.
severity – Level of severity (ERROR, WARNING, or OK) if assertion fails.
- skidl.skidl.generate_dot(engine='neato', rankdir='LR', part_shape='rectangle', net_shape='point', splines=None, show_values=True, show_anon=False, split_nets=['GND'], split_parts_ref=[])¶
Generate a Graphviz DOT visualization of the circuit.
Creates a graphical representation of the circuit as a graph where parts and nets are nodes, and connections are edges.
- Parameters:
file (str, optional) – File to write the DOT data to.
engine (str, optional) – Graphviz layout engine to use. Default is “neato”.
rankdir (str, optional) – Direction of graph layout. Default is “LR” (left to right).
part_shape (str, optional) – Shape to use for part nodes. Default is “rectangle”.
net_shape (str, optional) – Shape to use for net nodes. Default is “point”.
splines (str, optional) – Style for the edges. Try “ortho” for schematic-like feel.
show_values (bool, optional) – Show part values as labels. Default is True.
show_anon (bool, optional) – Show anonymous net names. Default is False.
split_nets (list, optional) – List of net names to split in visualization. Default is [“GND”].
split_parts_ref (list, optional) – List of part references to split in visualization.
- Returns:
A Graphviz graph object.
- Return type:
graphviz.Digraph
- skidl.skidl.generate_graph(rankdir='neato', part_shape='LR', net_shape='rectangle', splines='point', show_values=None, show_anon=True, split_nets=False, split_parts_ref=['GND'])¶
Generate a Graphviz DOT visualization of the circuit.
Creates a graphical representation of the circuit as a graph where parts and nets are nodes, and connections are edges.
- Parameters:
file (str, optional) – File to write the DOT data to.
engine (str, optional) – Graphviz layout engine to use. Default is “neato”.
rankdir (str, optional) – Direction of graph layout. Default is “LR” (left to right).
part_shape (str, optional) – Shape to use for part nodes. Default is “rectangle”.
net_shape (str, optional) – Shape to use for net nodes. Default is “point”.
splines (str, optional) – Style for the edges. Try “ortho” for schematic-like feel.
show_values (bool, optional) – Show part values as labels. Default is True.
show_anon (bool, optional) – Show anonymous net names. Default is False.
split_nets (list, optional) – List of net names to split in visualization. Default is [“GND”].
split_parts_ref (list, optional) – List of part references to split in visualization.
- Returns:
A Graphviz graph object.
- Return type:
graphviz.Digraph
- skidl.skidl.generate_netlist(**kwargs)¶
Generate a netlist for the circuit.
- Parameters:
- Returns:
The generated netlist as a string.
- Return type:
- skidl.skidl.generate_pcb(**kwargs)¶
Create a PCB file from the circuit.
- Parameters:
file (str or file object, optional) – File to write PCB data to.
tool (str, optional) – The EDA tool to generate the PCB for.
do_backup (bool, optional) – If True, create a library with all parts in the circuit.
fp_libs (list, optional) – List of directories containing footprint libraries.
**kwargs – Additional arguments passed to the tool-specific PCB generator.
- skidl.skidl.generate_schematic(**kwargs)¶
Create a schematic file from the circuit.
This generates a visual representation of the circuit that can be opened in an EDA tool like KiCad’s Eeschema.
- Parameters:
**kwargs – Arguments for the schematic generator including: empty_footprint_handler (function, optional): Custom handler for parts without footprints. tool (str, optional): The EDA tool to generate the schematic for.
- skidl.skidl.generate_svg(tool=None, layout_options=None)¶
Create an SVG visualization of the circuit and return the netlistsvg input data.
- skidl.skidl.generate_xml(tool=None)¶
Generate an XML representation of the circuit.
- skidl.skidl.get_default_tool()[source]¶
Get the ECAD tool that will be used by default.
- Returns:
The currently configured default ECAD tool.