← Back to team overview

kicad-developers team mailing list archive

Re: Component fields use case


On 08/31/2011 05:11 PM, Brian Sidebotham wrote:
> On 31 August 2011 22:42, Dick Hollenbeck <dick@xxxxxxxxxxx> wrote:
>>> Your best bet is to take a look at the generic netlist export, which is in XML.
>>> That format we hope to preserve, while the world around it might morph, for good
>>> cause.
>> http://www.mail-archive.com/kicad-developers@xxxxxxxxxxxxxxxxxxx/msg00531.html
>> Brian, where did we ever put your python generic netlist post-processor?
>> I could not find that on the mailing list.
>> Dick
> Hi Dick,
> I just had a look on that mailing list archive, but it is messed up.
> That was the right thread, but that mail archive does not match the
> mail archive I have on my machine!
> Anyway, I have re-attached the last python BOM scripts I did, and
> below is a copy of the email:
> It should be noted, as I've just looked that these are not Python 3.x
> compatible due to the print statements. Print in 3.x is now a
> function.
> ----------------------------
> 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,
> Brian.

Today, I committed these scripts into the source tree under


I don't see any copyright messages in these scripts Brian.  Feel free to fix that.
I eventually want to get something into KiCad's "installation" as well, but I'm thinking
currently of these as being in a staging area for refinement before we start installing them.

I have yet to use them, and have some rather high expectations on BOM since I have a Java
based one that I spent a good deal of time on, but now want to see that functionality
duplicated in the python stuff.  Once it is, and there is sufficient utility to justify
that these get "installed" as part of the KiCad package, we should then install them.

So we should consider this the first step in an evolving process, and any other
contributors are welcome to chime in.  In fact, we should probably take this BOM
discussion to a launchpad blueprint to capture the thread properly.  

The blueprint thread can also include how to use the current version of these python BOM