3
\$\begingroup\$

I'm a VHDL guy for work, and new to Kicad, so please forgive if this question is dumb.

I find it tedious to copy and paste a lot of circuit chunks to get the large matrices of diodes, IGBT's, etc for a high voltage, high current power supply. I much prefer to generate the netlist in Python. My reasons are as follows:

  1. It is labor intensive. I just plain hate hours of copy & paste.
  2. It is error prone. If I can get an algorithm that generates these circuits correctly, the result will be much more reliable than anything I draw by hand.
  3. I can easily simulate and build the same thing.

Assume that I have already entered symbols into Kicad so that it knows how to display components. Likewise for sub circuits. Also don't worry about how ugly the schematic is. I know having a schematic is great documentation, etc. I am asking the question at hand, nothing more.

What I want to do is import a file of S-expressions representing netlist and location information.

Does Kicad allow this?

If so, how do I do it?

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

You can very easily generate KiCad schematic and PCB files using Python. There's no need to "import" anything into KiCad: just generate the simple format KiCad can natively read. It's a simple S-expression format. If you can generate a netlist, so can you generate perfect schematics and layouts that way!

If you need some ad-hoc code, I wrote some myself for converting font source files from KiCad 5 symbol libraries (.lib) to KiCad 6+ libraries (.kicad_sym). The overall file structure is the same for schematics and libraries - minor details differ. Look here:

A more full-fledged Python API for S-expr file I/O is also available from the KiCad Libraries project:

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.