skidl.circuit module¶
Handles complete circuits made of parts and nets.
- class skidl.circuit.Circuit(**kwargs)[source]¶
Bases:
SkidlBaseObject
Class object that holds the entire netlist of parts and nets.
- parts¶
List of all the schematic parts as Part objects.
- nets¶
List of all the schematic nets as Net objects.
- buses¶
List of all the buses as Bus objects.
- hierarchy¶
A ‘.’-separated concatenation of the names of nested SubCircuits at the current time it is read.
- level¶
The current level in the schematic hierarchy.
- context¶
Stack of contexts for each level in the hierarchy.
- add_hierarchical_name(name)[source]¶
Record a new hierarchical name. Throw an error if it is a duplicate.
- backup_parts(file_=None)[source]¶
Saves parts in circuit as a SKiDL library in a file.
- Parameters:
file – Either a file object that can be written to, or a string containing a file name, or None. If None, a standard library file will be used.
- Returns:
Nothing.
- erc_list = [<function dflt_circuit_erc>]¶
- generate_dot(file_=None, engine='neato', rankdir='LR', part_shape='rectangle', net_shape='point', splines=None, show_values=True, show_anon=False, split_nets=['GND'], split_parts_ref=[])[source]¶
Returns a graphviz graph as graphviz object and can also write it to a file/stream. When used in ipython the graphviz object will drawn as an SVG in the output.
See https://graphviz.readthedocs.io/en/stable/ and http://graphviz.org/doc/info/attrs.html
- Parameters:
file – A string containing a file name, or None.
engine – See graphviz documentation
rankdir – See graphviz documentation
part_shape – Shape of the part nodes
net_shape – Shape of the net nodes
splines – Style for the edges, try ‘ortho’ for a schematic like feel
show_values – Show values as external labels on part nodes
show_anon – Show anonymous net names
split_nets – splits up the plot for the given list of net names
split_parts_ref – splits up the plot for all pins for the given list of part refs
- Returns:
graphviz.Digraph
- generate_graph(file_=None, engine='neato', rankdir='LR', part_shape='rectangle', net_shape='point', splines=None, show_values=True, show_anon=False, split_nets=['GND'], split_parts_ref=[])¶
Returns a graphviz graph as graphviz object and can also write it to a file/stream. When used in ipython the graphviz object will drawn as an SVG in the output.
See https://graphviz.readthedocs.io/en/stable/ and http://graphviz.org/doc/info/attrs.html
- Parameters:
file – A string containing a file name, or None.
engine – See graphviz documentation
rankdir – See graphviz documentation
part_shape – Shape of the part nodes
net_shape – Shape of the net nodes
splines – Style for the edges, try ‘ortho’ for a schematic like feel
show_values – Show values as external labels on part nodes
show_anon – Show anonymous net names
split_nets – splits up the plot for the given list of net names
split_parts_ref – splits up the plot for all pins for the given list of part refs
- Returns:
graphviz.Digraph
- generate_netlist(**kwargs)[source]¶
Return a netlist and also write it to a file/stream.
- Parameters:
file – Either a file object that can be written to, or a string containing a file name, or None.
tool – The EDA tool the netlist will be generated for.
do_backup – If true, create a library with all the parts in the circuit.
- Returns:
A netlist.
- generate_netlistsvg_skin(net_stubs, layout_options=None)[source]¶
Generate SVG for schematic symbols for netlistsvg skin file.
- Parameters:
net_stubs (list) – List of nets that are stubbed rather than routed.
layout_options (str, optional) – String of ELK layout options. Defaults to None. https://eclipse.dev/elk/reference/options.html
- Returns:
SVG for skin file.
- Return type:
- generate_pcb(**kwargs)[source]¶
Create a PCB file from the circuit.
- Parameters:
file – Either a file object that can be written to, or a string containing a file name, or None.
tool – The EDA tool the netlist will be generated for.
do_backup – If true, create a library with all the parts in the circuit.
fp_libs – List of directories containing footprint libraries.
- Returns:
None.
- generate_svg(file_=None, tool=None, layout_options=None)[source]¶
Create an SVG file displaying the circuit schematic and return the dictionary that can be displayed by netlistsvg.
- Parameters:
file (_type_, optional) – Filename to store SVG. Defaults to None.
tool (_type_, optional) – Backend tool. Defaults to None.
layout_options (_type_, optional) – Options to control netlistsvg/ELK layout algorithm. Defaults to None.
- Returns:
JSON dictionary for input to netlistsvg.
- Return type:
- generate_xml(file_=None, tool=None)[source]¶
Return netlist as an XML string and also write it to a file/stream.
- Parameters:
file – Either a file object that can be written to, or a string containing a file name, or None.
tool – Backend tool such as KICAD.
- Returns:
A string containing the netlist.
- property no_files¶
Prevent creation of output files (netlists, ERC, logs) by this Circuit object.