← Back to team overview

kicad-developers team mailing list archive

Re: BOM support


Hi Guys,

I have attached a first effort for some python scripts. Still some
work to do, but there are some example BOM generators which create
list, csv and html versions of a BOM.

The code should work with anything above python 2.3 (including 3.x) so
we shouldn't have any issues with python versions. The main stumbling
block appears to be string formatting. The % method is soon to be
deprecated in the 3.x series of python. V2.7 is apparently going to be
the last version in the 2.x series. Development will now only
concentrate on the 3.x series.

The reader I implemented creates a complete netlist tree in RAM, so
everything is available to do with what you want.

The examples start easy, and get more complex:

bom_example1.py - Create a simple list, one component per line, tab
delimited (similar to kicad original BOM output)
bom_example2.py - As above, but CSV output, suitable for open office
or excel, etc.
bom_example3.py - As (2), but with components grouped by matching
values + library parts
bom_example4.py - As (3), but HTML format instead
bom_example5.py - Demonstration of a more sophisticated method of
output formatting and grouping technique

There is definitely some more testing to do, and probably some more
tidying up and what not, but attached is where it's currently at.

All comments and suggestions welcome as always.

I have been using the following plugin command: python
/path/to/example/script.py %I example.lst, csv, htm, etc.

Best Regards,


On 19 August 2010 15:11, Dick Hollenbeck <dick@xxxxxxxxxxx> wrote:
> On 08/18/2010 05:11 PM, Karl Schmidt wrote:
>> Is there enough of the BOM there to build and test - will it export xml?
>> Anything else major broken?
>> Or should I arrange my BOM by hand for now?
> Karl,
> There will be about 6 or more BOM solutions I hope.   And I hope you,
> among others, can develop your own and share it with others such that it
> can be customized and improved.
> I especially like the idea you had for integration with gnumeric, which
> I use also.
> Generally the description of the gateway to push out the XML and invoke
> an external script is here:
>    https://lists.launchpad.net/kicad-developers/msg05157.html
> The BOM icon in eeschema is a relic, you go through the netlist export icon.
> Brian S. is working on a python solution, for which I am excited to
> start playing with.
> Attached is a rudimentary XSL that is about 15% of what it should or
> could be.  So that leaves us at
> .15
> -----------------       =   2.5 % done
> 6 solutions total
> Please feed back what you come up with on the gnumeric.  You could learn
> XSL and be a hero, or python, or SQL, or whatever.
> Dick
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

Attachment: ky.zip
Description: Zip archive

Follow ups