Command line for generate netlist

hi there, does kicad support generate netlist in command line? eg: “some_command xxx.sch -o” or something else?

There is:

Oops, the text below is well ment, and directly copied from the Eeschema manual, but I did not read the whole article and it may be wrong / misleading. Sorry for that.

Command line format
Here is an example, using xsltproc.exe as a tool to convert .xsl files, and a file netlist_form_pads-pcb.xsl as converter sheet style:

f:/kicad/bin/xsltproc.exe -o f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I


This doesn’t work. KiCad generates an intermediate netlist in XML format, then uses the XSLT to transform it. The XSLT uses this intermediate netlist (not the .sch file), and there doesn’t seem to be a way to generate the intermediate from the command line.

I also would like to programmatically generate netlists. It seems that KiCad isn’t aimed at non-interactive use, which is a shame. None of the binaries even recognize -h or --help.

You are confusing the BOM stuff with the netlist.

@paulvdh i think that example is for converting one format to another not for generating something out of kicad.

There are Python libraries for reading a .kicad_pcb, but that is not a schematic.
(Python) scripting for Eeschema is not really there yet.

Because of the openness of KiCad, several people are experimenting with (mostly Python?) scripts and other extensions, but those are not maintaind by “KiCad”.
KiCad’s drawings are also all text based, pretty simple and documented on the Kicad site.

For programmatically generating netlists, you want “skidl”, which is one of the projects “surrounding” KiCad.

Github is not indexed well by regular search engines, but if you search github directly you find roughly 4800 repositories (with lots of copies and who knows what).
And when you refine your search to “Python”, then 414 are left, which is a bit more managable.

I once saw a list of about 20 such projects on github, but I can’t recall where exactly. A shorter list is on the KiCad website itself:

@paulvdh Skidl appears to be a wholesale replacement for eeschema, rather than a tool which can generate netlists from eeschema-created schematics.

I put together a gross solution that covers my usecase, which runs eeschema in a virtual framebuffer X server and calls xdotool to interact with it. It’s disgusting, but it works.

#! /bin/bash
# 2019, Ian Eure.
# This code is in the public domain.

set -e
set -u


Xvfb :99 &
export DISPLAY=:99

eeschema $SCH &

while [ "$MWID" = "" ]; do
    sleep 1
    MWID=$(xdotool search --onlyvisible --sync --classname Eeschema)
echo "Found eeschema window $MWID"

xdotool key --window $MWID alt+t n

# Wait for the export window.
while [ "$EWID" = "" ]; do
    echo "Waiting for export window..."
    sleep 1
    EWID=$(xdotool search --onlyvisible --sync --classname Eeschema | grep -v $MWID || true)
echo "Found export window $MWID"

xdotool key --window $EWID "Return"

# Wait for the file dialog window
while [ "$FWID" = "" ]; do
    echo "Waiting for file window..."
    sleep 1
    FWID=$(xdotool search --onlyvisible --sync --classname Eeschema | grep -v $MWID | grep -v $EWID || true)
echo "Found file window $FWID"

xdotool key --window $FWID "Return"

# Wait for the window to close
while [ "$_CLOSED" = "$EWID" ]; do
    echo "Waiting for export window $EWID to close..."
    sleep 1
    _CLOSED="$(xdotool search --onlyvisible --classname Eeschema | grep $EWID || true)"
echo "Export window closed."

echo "Closing eeschema"
xdotool key --window $MWID alt+f c

kill %1
kill %2 || true

So that’s what Skidl is then.
It’s a program that generates netlists (from scratch).

Skidl is for a PCB, what VHDL is for an FPGA.
I have never used it myself (yet), I think I heared it’s name first here on the forum where a blind guy used it for schematic entry.
For some types of PCB it does not make sense to draw a schematic, but (almost) everybody draws schematics because it’s the defacto standard.

When I see a schematic that is mostly schematic symbols connected with labels then it does not make much sense to me. What are all the connections to this or that particular label? For those kind of schematics Skidl seems to make more sense for “schematic entry” than a graphical program.

Unfortunately my attention is already spread too thin over various subjects to give much attention to Skidl.

GUI Scripting is tried and true, but very delicate and ugly.

On the other hand if it is a fixed environment, maybe ok, it it works it ships!

If you want to discuss, I am trying to start a project for strapping this automation on top of the entire kicad workflow, and to identify missing functionality in the kicad source base for bug reports/feature requests, with the goal of generating a complete pipeline in travis. Generating netlists is a top priority along with DRC output. If you are interested to discuss the options we can talk here or pm. In that environment xdotool will work but maintenance and build image size leaves much to be desired.

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