XML file with command line

Hello , is there is a way to generate the XML file ( kicad netlist info ) with a command line ? I need it for a script ! Thank you

Maybe a KiCad automation tool like this: https://github.com/productize/kicad-automation-scripts can do the job? I think there are other candidates. Disclaimer: I’ve not tried such tools.

1 Like

I got my respond, there is no way for the moment to generating the XML netlist required to export BOMs, we have to use the graphical interface.
Thank you.

Those automation tools are a way to pretend to be a human clicking and typing to the application. The one I referenced uses the xdotool application. But that probably means it only works on Linux. V7 should have a Python API for the schematic editor.

Mmm, I do ponder why we don’t have a basic xml export tab.

If you “Add Generator” in the Netlist dialog, and hookup say ruby, python, whatever command line, it actually gets an XML netlist file as input.

For example on Windows:
image

It’ll ask you where to save the XML file, and open a dummy cmd window that immediately closes.
But you get to keep the XML file.

Alternatively, route it directly into your actual processing script.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<export version="E">
  <design>
    <source/>
    <date>9/1/2022 8:24:12 AM</date>
    <tool>Eeschema (6.0.7)</tool>
    <sheet number="1" name="/" tstamps="/">
      <title_block>
        <title/>
        <company/>
        <rev/>
        <date/>
        <source/>
        <comment number="1" value=""/>
        <comment number="2" value=""/>
        <comment number="3" value=""/>
        <comment number="4" value=""/>
        <comment number="5" value=""/>
        <comment number="6" value=""/>
        <comment number="7" value=""/>
        <comment number="8" value=""/>
        <comment number="9" value=""/>
      </title_block>
    </sheet>
  </design>
  <components/>
  <libparts/>
  <libraries/>
  <nets/>
</export>
2 Likes