← Back to team overview

kicad-developers team mailing list archive

Re: BOM support

 

Dick Hollenbeck a écrit :
Jean-Pierre,

First, I apologize for saying the BOM C++ code is garbage.  (I had my
special hat on,  :) you know the one that says any code I have not
written is garbage.  It's a
silly self-misleading hat, but I sleep in it.)

Well, a lot of guys have the same opinion...
But I must say: indeed, BOM C++ code is garbage.

Some features (like the labels list) are more a debug tool than an usefulfeature.

I fact I use very few the BOM generator.



Does the output of netform.cpp's Write_GENERIC_NetList() have what is
needed in it to create a BOM?


If so, here is my current thinking, obviously it is evolving as I do the
research, before the development.

What we need is almost entirely present in the existing *generic netlist
exporter*. (EESCHEMA -> Netlist -> Add Plugin).

I am happy you are thinking to use this approach.
Write_GENERIC_NetList() could have some minor problems in complex hierarchies (about timestamp/sheet path).
(I can fix them, if you want)
It should be usable.


This can export the netlist to a text file and chain load a post
processor to generate a "netlist" of any kind.  Is there a reason this
cannot generate a BOM?  The only netlist plug-in in existence is in
eeschema/plugin/netlist_form_pads-pcb.cpp, and this represents the only
dependency on the existing non-XML "generic netlist format", which is an
arbitrary format that I would like to change to XML.


What about the following plan of action, for which I am volunteering:


1) Change the generic netlist exporter to export to XML, keeping all the
existing content, even pins, and *adding* all custom component
fieldnames/properties.

Write_GENERIC_NetList() is mainly intended to create files very easy to read.
Therefore files have just the minimal info to create basic netlists.
Of course for BOM generation, fieldnames/properties  must be added, but some extra info could be useful:
Sheet path name.
Location in a sheet.
Electrical pins type and perhaps pin names (useless for a BOM, but power pins could be more easily located in a board).
Pay attention to multi parts per package:
these components are always tricky to handle.
(For the same component, they can have different values for a given field,
and have different location or sheet name)


2) Fix netlist_form_pads-pcb.cpp to read the new generic netlist format
XML file, using the xml support within wxWidgets, see wxXmlDocument, and
create the same output it uses now.  I'm hoping what was a non-gui
program can still stay that way using this class, don't know yet.

netlist_form_pads-pcb.cpp is of course useful for guys who have to createpads-pcb netlists,
but can be mainly see as a sample to create custom formats.
So fix this file after changes is very interesting.

In fact i am thinking others netlist formats (pspice, cadstar) could use this intermediate format,
and could be removed from the eeschema code itself.

3) Work with Brian to write one or more python scripts, which will
basically fix bug https://bugs.launchpad.net/kicad/+bug/581153

4) Commit the C++ improvements I made yesterday to the existing BOM
generator and keep them until a higher authority deletes them.

5) I bail on fixing bug https://bugs.launchpad.net/kicad/+bug/581153 in
C++, which I deem being a lost cause, because I think the BOM generator
C++ is a lost cause.  Use any one of the python scripts to overcome it.


Dick



--
Jean-Pierre CHARRAS








Follow ups

References