8.1. pyopus.netlister.kicad — KiCad netlister

Main KiCad netlister module.

Invoke it by running

python3 -m pyopus.netlister.kicad <options>

Command line arguments:

  • -t, --console - run in console mode. Displays output and errors in console. By default the netlister runs in GUI mode where the resulting netlist and errors are reported by popping up a window.
  • -c, --config-file - name of the default config file/name suffix. If not specified netlister.json is used. This must be a file name, not a path to a file. The config file is assumed to be in the same folder as the intermediate XML netlist file.
  • -s, --skip-config - do not read a config file in JSON format.
  • -n, --no-print-netlist - disables displaying the netlist on success.
  • -d, --dump-config - dumps the configuration in JSON format to an output file if it is specified with -o. Otherwise dumps to a popup window or STDOUT (if -t is specified). This feature is useful for debugging. It can also be used for creating an initial configuration file that is a starting point for customizing netlist generation.
  • -i, --input-file - input KiCad XML netlist file. Default is netlist.xml.
  • -o, --output-file - output Spice Opus netlist file Default is netlist.cir. Also used for specifying where to store the JSON configuration file.

By default a JSON config file is read from <output file>.netlister.json. If this file is not found the config is read from netlister.json. The default configuration file/name suffix can be specified with the -c option. The configuration file is assumed to be in the same folder as the intermediate XML netlist.

The config file is in JSON format. The mapping member is dumped as a list. Every component mapping is a list with 3 elements: library name, component name, and an associative array with the same keys as the description of an entry in the mapping member of config.

To use it from KiCad, select Tools/Generate Netlist File in Eeschema menu. Click “Add Plugin” and enter:

python3 -m pyopus.netlister.kicad -i "%I" -o "%O"

as the “Netlist command”. For Windows the command should be:

<full path to pythonw.exe> -m pyopus.netlister.kicad -i "%I" -o "%O"

Enter:

Spice Opus

as the “Title”. A new tab named “Spice Opus” will appear. You only need to do this once. KiCad will store your settings in its configuration. For Linux make sure python3 is in your path. Also make sure PyOPUS installation folder is listed in the PYTHONPATH environmental variable if PyOPUS is not installed in the Python libraries folder.

To generate a Spice Opus netlist, select the “Spice Opus” tab, click on “Generate” and select an output file for the netlist. A window with the generated netlist will pop up. In case of an error the window will show the error message. To disable the popup window and show it only in case of an error add the -n option to the netlister.