Skip to main content

Output formats

The circuitscript command detects the output format based on the file extension of the output path.

SVG format

Generates a single SVG output. Even if there are multiple sheets defined in the code, only a single SVG file is generated.

Example command: circuitscript input.cst output.svg

PDF format

Generates a single PDF output. Sheets defined in the code will be generated on consecutive pages.

Example command: circuitscript input.cst output.pdf

KiCad netlist format

Please ensure that all physical components have a footprint defined in their params.

Example command: circuitscript input.cst output.net

KiCad schematic format

Generates a KiCad .kicad_sch file. Unlike the netlist format, this preserves the symbol positions you authored in the schematic. Use --kicad-version to select the target KiCad file version (9 or 10, default 9) — see the CLI reference for details.

Example command: circuitscript input.cst output.kicad_sch --kicad-version 10

Interactive HTML viewer format

Generates a single standalone HTML file embedding the rendered schematic. It supports pan and zoom (drag to pan, scroll or pinch to zoom, plus zoom in/out/fit buttons), and clicking a component opens a side panel listing its pins, connected nets, and parameters. From that panel, clicking a net name highlights all of that net's wires and junctions in the schematic.

Example command: circuitscript input.cst output.html

ngspice netlist format

Generates a .cir netlist for simulation in ngspice. Circuitscript does not run the simulation itself — it only exports the netlist; you load the .cir file into ngspice to simulate it.

Only two kinds of components are exported to the netlist: two-terminal passives whose type param is res, cap, ind, or diode (emitted with their value), and components with type: "sim" that carry a sim: block. Any other component is silently omitted from the output.

A component's SPICE model can be overridden with the ..sim_model param. For a diode component this becomes the .model D_model_<refdes> <value> line; for the other passives it is appended after the value. For example:

..sim_model = "D(IS=1e-14 N=1 RS=1.2 BV=5.1 IBV=5m)"

A component with type: "sim" also needs a sim: block with a type entry. The only implemented instance type today is voltage_source, which requires a voltage entry: a plain numeric value renders as DC <value>, while a string is passed through verbatim (for example "SIN(0, 5, 10k)").

document.sim.title sets the netlist's first comment line (default * TITLE).

Example command: circuitscript input.cst output.cir

Here is a voltage source component definition, adapted from a Circuitscript test fixture:

def sim_v_source(voltage):
return create component:
pins:
1: "+", "power_output"
2: "-", "power_ref"
type: "sim"
params:
refdes_prefix: "V"
sim:
type: "voltage_source"
voltage: voltage

Instantiating it with sim_v_source("SIN(0, 5, 10k)"), together with a couple of diodes carrying a ..sim_model override and setting document.sim.title = "Simulation test", produces a .cir file that starts like this:

* Simulation test
.model D_model_D1 D
.model D_model_D2 D(IS=1e-14 N=1 RS=1.2 BV=5.1 IBV=5m)
.model D_model_D3 D(IS=1e-14 N=1 RS=1.2 BV=5.1 IBV=5m)

D1 _D1_2_ 5V D_model_D1
R1 _D1_2_ 0 10k

and ends with the voltage source line and .end:

V1 5V 0 SIN(0, 5, 10k)
.end

Multiple outputs

Pass --o <fileName> one or more times to write additional output files from a single run, alongside the primary output path. Each --o value is a full output path and can use a different extension than the primary output — see the CLI reference for the full flag list.

Example command: circuitscript input.cst output.svg --o output.pdf --o output.net