← Back to team overview

kicad-developers team mailing list archive

Re: Component fields use case

 

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.

Attachment: ky2.zip
Description: Zip archive


Follow ups

References