KiCad and BOM

Let’s try creating a BOM (Bill Of Materials) file that fits your own convenience.

Firstly, export the intermediate netlist file without using any plugins.

Then, you will get an XML file something like the above.

# filename = xmlparse.pl
import xml.etree.ElementTree as ET
tree = ET.parse('RF-ATT.xml')
root = tree.getroot()

for value in root.iter('value'):
	print(value.text)

A short python program to parse an XML tree will give you the following results.

% python xmlparse.pl

Conn_Coaxial
Conn_Coaxial
SW-6P
1800
1800
3
SW-6P
910
910
5.6
SW-6P
300
300
18
SW-6P
220
220
24
SW-6P
150
150
39
SW-6P
100
100
75
SW-6P
62
62
240

Or by adding a shell script:

% xmlparse.py | sort | uniq -c

   2 100
   2 150
   1 18
   2 1800
   2 220
   1 24
   1 240
   1 3
   2 300
   1 39
   1 5.6
   2 62
   1 75
   2 910
   2 Conn_Coaxial
   7 SW-6P

This simple output may be of some use depending on the situation, but what you really wish to get is a list containing part numbers and/or part names that your favorite local parts vendor will understand.

Leave a Reply

Your email address will not be published. Required fields are marked *