Any methods/script of export a netlist from a kicad pcb

I have a task of getting all netlists from the exist kicad pcb designs. can I make it just like the export netlist directly from a kicad PCB file? I remember the Allegro have this kinds of script API, how’s about KiCad?

Why not from schematic?

I haven’t got the schematics file… all these pcb files are finished proejcts from other design platforms

I’m not clear about what you’re asking, as follows:

First:
You say you have “…exist Kicad pcb designs.” Then, added info; “…all the pcb files are finished projects from other design platforms”

So, either they’re existing from Kicad PCB or from other platforms. A pcb file can’t be from both Kicad and some other program.

Perhaps posting an example file will add clarity…

Second:
The intended purpose is also important: i.e., for simulations? for BOM’s, for what purpose do you need a ‘Netlist’

Tell us exactly what you want to do and what the expected results should be (a simple script to read a file is a no-brainer but, to make a Netlist is not so simple…

ADDED: If the PCB’s you have are Kicad and you can Open them in Kicad’s PCB then, consider Exporting an IPC-D-356 Netlist. Perhaps that is all you need/want…

File>Fabrication_Outputs>IPC-D-356

Perhaps the files from other platforms could be imported into KiCad and thus he has a KiCad PCB file?

O, i think I should make my question more clear.
all the pcbs are design by other platform design like Allegro or PADS and then convert to KiCad pcbs. what I have just only the converted KiCad PCBs. and I need to export a common OrCAD/PCB II Netlist Format like this:

 ( 0103E047 C1206-19 C1 10UF
  ( 1 VCC5V )
  ( 2 GND )
 )

1, using the *.cmp and the ipc356 netlist files together of BlackCoffee mentioned to combine the format I wanted.
2, reading the pcb file directly. but seems much more complicated
3, both of all should can be done by any script lanauage like python. perl. also the KiCad’s internal python API but I am not familiar with,

And the key thing here, I also confusing on the 0103E047 of line “0103E047 C1206-19 C1 10UF”… seems like a timestamp or something unique code, how to make it…

I have never looked into KiCad files, but I have read (in KiCad V4 pdfs those time) that when you place element at schematic it gets its unique code (based on timestamp). That allows KiCad to correctly update PCB to schematic even if you change symbol references at schematic between updates.

1 Like

You can create a Simple Plugin to read the PCB file (and/or any file) and Parse it for the Items you want, such as Net’s…

I wrote this to list all contents but could easily add code to get the Nets/etc and do-something with them…

If you have programming skills and/or want to learn, there’s plenty of info on this forum (and elsewhere). Look for the “Simple Plugin” info… @eelik has an excellent write-up https://gitlab.com/eelik-kicad/kicad-doc/-/wikis/Plugin-howtos

The Kicad-Plugin info: isHere

ADDED: Don’t forget, there’s a ‘Net Inspector’ tool ( Inspect>Net Inspector). It will create a Report

Screenshot of my very basic python content reader - it uses the most basic Python file reading: readlines()

1 Like

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