KiCad and BOM (2)

Marutsu is an electronics component vendor in Japan. They accept BOM files in the following format;

It seems that they only understand Japanese language encoded in Shift_JIS. This is somewhat unfortunate, but the basic idea is always the same.

# coding: utf-8
import xml.etree.ElementTree as ET
import re

print('"型番","メーカー名","数量"')

tree = ET.parse('RF-ATT.xml')
root = tree.getroot()

regex = r'R[0-9]+'

for node in root.iter('comp'):
	name = node.attrib.get('ref')
	if re.search(regex, name):
		for value in node.iter('value'):
			string = '1/4WキンピR '+value.text+'Ω,KOA,1'
			print(string)

This is a python program that converts the XML file (intermediate net list) from KiCad to a BOM file to be uploaded to Marutsu.

% python xml2bom.py | nkf -s > BOM.csv
$ cat BOM.csv | nkf -w
"型番","メーカー名","数量"
1/4WキンピR 1.8KΩ,KOA,1
1/4WキンピR 1.8KΩ,KOA,1
1/4WキンピR 3Ω,KOA,1
1/4WキンピR 910Ω,KOA,1
1/4WキンピR 910Ω,KOA,1
1/4WキンピR 5.6Ω,KOA,1
1/4WキンピR 300Ω,KOA,1
1/4WキンピR 300Ω,KOA,1
1/4WキンピR 18Ω,KOA,1
1/4WキンピR 220Ω,KOA,1
1/4WキンピR 220Ω,KOA,1
1/4WキンピR 24Ω,KOA,1
1/4WキンピR 150Ω,KOA,1
1/4WキンピR 150Ω,KOA,1
1/4WキンピR 39Ω,KOA,1
1/4WキンピR 100Ω,KOA,1
1/4WキンピR 100Ω,KOA,1
1/4WキンピR 75Ω,KOA,1
1/4WキンピR 62Ω,KOA,1
1/4WキンピR 62Ω,KOA,1
1/4WキンピR 240Ω,KOA,1

After uploading the BOM file, you will have;

and you are ready to place an order.

Leave a Reply

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