Making a good BOM is not simple

I can see that making a good Bill of materials BOM is not valued enough. It is not simple fire and forget script. In a commercial CAD I once used, Bom function was highly customizable and there were a lot of field names, and export options.

1 Like

Most users agree with you, especially the customization part.

Where the disagreements occur is in “how do you want to actually implement it?” Everyone has different requirements.

Some users want manufacturer names and part numbers in the symbols so they are included in the BOM as generated from schematic. That BOM is “final,” and no further processing on it is necessary.

Others prefer a “house part number” in the symbol which is a key in a parts database that is maintained by someone at the computer. The BOM generated by Schematic will be fed into the planner’s system and a parts list for purchasing gets generated, and another parts list for the assembly tech can be generated as well.

Still others don’t care one way or the other. They’re hobbyists.

In this forum, you might have seen a discussion about what fields KiCad’s symbols should include by default. Specifically, there are those who advocate a mandatory “Part Number” field. (I am one of those users.)

All that said: KiCad 6 ships with a few “example” BOM generators, written in Python, and executed from the Schematic with the “Generate BOM tool” from the Schematic editor. They will take the schematic and generate a file in CSV, HTML and plain text formats. The files will include all of the parts in the design, sorted by reference designator or value, and all of the fields in each symbol are included.

Previous versions of KiCad included XSLT scripts to generate the BOM from schematic. The Generate BOM function in KiCad created a netlist in XSL format, and the script parsed that XSL file to pull out the parts and organize them by value and reference designator. The scripts are somewhat cryptic, but with some study you can grok them.

As I said, the current KiCad uses Python scripts for the BOM generation. Python is a relatively straightforward language, and the scripts make sense, so modifying those example scripts to suit your needs is not difficult. I took it a step further and revamped a Python script I wrote awhile ago which parsed the output from the XSL parser against a CSV file that holds my main parts list. The new script is executed directly from within the KiCad schematic editor.The adventure is documented here, with links to the script.

I understand that hacking Python scripts is not for everyone. I wish I had a better answer for you, other than “Yes, making a good BOM tool is valued more than you realize.”

You can see that others have the same question.

I understand.

Parts library should also be flexible.
I’ll give files from Kicad elsewhere, and they have to be able to buy those parts too. Then there is JLCPCB with their parts list.
And then hobbyists, I have made those boards, too.

I should not comment much, or we are copying an old CAD I was using, but a part library entry and BOM are related. If there are no “Manufacturer” field, there is not much to put in the BOM “Manufacturer” field.

As a compromise: How about JLCPCB specific part library and bom? Not for my paid job, but JLCPCB have exact instructions about BOM and production documents.

JLCPCB should take the lead on creating a KiCad library for the parts they stock. If you want this, it has to be “official.” Also, why should a 3rd-party volunteer do all of this work?

This leads to some good questions, like, “should JLCPCB remove a part from their library if they stop stocking it?” and “what about passives like resistors?”

I don’t want JLCPCB stuff polluting my schematics. I don’t want DigiKey part numbers polluting my schematic. All of these are moving targets, anyway.

And while there is a lot of merit to adding manufacturer name and part number to a schematic, consider the humble 0603 1% resistor. Probably a dozen companies make these things, and they’re all pretty much interchangeable, so which manufacturer and which part number do you put in your fields? And then how do you handle those part numbers? Do you have one library entry per resistor value, because the part numbers are different for each?

This is an old question. For a hobbyist it does not matter what is in the Bom, or if there is no a parts list. But if you work somewhere where there is a sourcing department/buyers, generic part is not good. Byers do not know about electronics, so they don’t have to know what is a generic part.
KiCad should should be suitable for both hobbyists and paid work. I understand that people don’t want something in their schematic, and every serious user should make his or hers own parts library anyway and BOM to match too. That’s why there should be some official libraries and BOM tools, to show how they should look like.

JLCPCB is a useful PCB manufacturer, I don’t care who uses their PCBs, but supporting them would help hobbyist, and serve as model for others.

And we once had a long discussion, whether we should use one library component with different values, Like Tesla resistor manufacturing SMD resistor 0603 model 12345 and let values tell which resistor to use, but then we made each value a separate entry.

Kicad can do several flavors of BOM’s. And, user can Tweak the .PY file that’s used for it.
BOM’s can be done from PCB and from Eeschema but, they are different beasts.

Try this:

  1. Decide what you want in the BOM (naturally, it’s based on the Data/Fields in the Symbol/Footprint.

  2. Review the various .PY files in Kicad and discover the Keywords/etc for them (also look at the BOM exported from PCB).

  3. Tweak the .PY as needed and save with new Name.

I have a few I did and my favorite is HTML followed by CSV (that I further customize in LibreOffice’s spreadsheet app).

You’ll need to discover how to implement it’s use (pretty easy but, not necessarily clearly understood).

Thus, for your amusement, my HTML version attached (I hacked it from a stock one)
Screenshot of some code and the actual file… (3.0 KB)

The Result shown in Firefox

Not bad. Then I wish libraries would be neat, so that something like could be made. (That is: do your own libraries)
One question, How is this add on? used. Where to put it, and how to start it.

You’ll need to do some homework to clear-up any confusion but, basically, here’s the scoop on BOM’s:

BOM, from PCB editor: Fabrication_Outputs> BOM

BOM, from Eeschema: Tools>Generate_BOM

Put the file I posted in the folder called: SharedSupport>Plugins (finding it is part of your homework).

If the folder contains a file called “” then, all should work…
(when you’ve Quit and Re-started Kicad, then, arrive at the Panel (via clicking Generate_BOM), you should see the File you placed in the Folder. Select it and OK, it will make the BOM and put it in the Project’s folder.)

I do work where there’s a buyer, and a proper ERP system. And you’re right, our buyer doesn’t want to know about generic parts.

Which is why the company Altium libraries have a custom PN field in every part, and that PN field is populated with a value that indicates the part number in our system’s database. That database has verified manufacturer names and part numbers for each and every thing we buy. It supports multiple vendors for things like our 0603 1% resistor.

A BOM is generated from the schematic and run against that master data base. Our buyer then gets a list of parts to order. That list has our part number, the manufacturer name, the manufacturer part number, and the quantity required. She submits the parts list to a distributor.

Now’s she’s really smart, she knows about parts. But in every case where there is a problem with obtaining the parts specified in the design, she calls the responsible engineer and asks about substitutes. She won’t take it upon herself to decide that Part B is an acceptable substitute for Part A.

And it is.

As I said, if JLCPCB wants to steer customers in their direction, it would make sense for them to create and maintain their own library and offer it to anyone who wants to use it.

I see no point in “the community” developing a tool that benefits a for-profit company.

I agree that making a good BoM is a complex task. And this isn’t a KiCad problem.

KiBot can be used to generate HTML, XLSX, CSV, TSV and TXT BoM like this or this. Note that these examples where generated without configuring KiBot, in fact KiBot generated all these BoMs. You have a high degree of configurable stuff on KiBot and we are open to add more options.

KiBot currently works on CI/CD environments (like GitHub and GitLab) and on Linux systems. Running it on Windows is currently tricky (you must install WSL).

Generating BOM should begin with making good part libraries. I have began to think that every user should do his/hers own part libraries. And BOM generator should be able to use data in those. It should also be possible to have some useful or meaning names data fields, Field1 Field2 and so on, are silly.

It should be easy to import data data from official (KiCad ) part library, and from libraries from other sources.

I haven’t actually used the BOM scripts which come with KiCad (because editing them didn’t have enough ROI compared to just exporting BOM from Pcbnew and editing it with LibreOffice), but I think those field names in some script were just examples, and the script was meant to be customized.

Of course it’s not good usability, and a flexible GUI which is still simple enough that it can cover most use cases is needed, and the need is known to the developers, and is in plans. But as you know, there are n plans and n^2 needs and only a handful of developers. You (anyone) can try to design an easy to use yet flexible GUI and show us what it looks like.

KiCad provides the flexibility to create your own field names in EESchema. Check the preferences for “Field Name Templates”. Here you can create your own custom fields that will apply to all schematics after you define them in preferences. Here I made 3 dummy names to demonstrate:

Then you should be able to write (or customize one of the existing) Python scripts to use these field names in addition to the defaults when generating BOMs.

Yes, this requires you to do the customization yourself, but it should only need to be a one time thing.

Yes, and there are some common names used by tools like KiCost (integrated in KiBot). But this is very personal. I always suggest users to use separated fields for things like tolerance, power, voltage, current, etc. You can join those fields in the BoM and you get more flexibility in the sorting and positioning of these values. But some people doesn’t like it, is just a question of preferences.

1 Like

I typically put an internal part number (IPN) in my schematic symbols, and then create a spreadsheet to cross reference IPN to MPN. Then I can do anything I want – change sources, multiple sources, etc. Also created GitPLM, which is a tool that takes a KiCad BOM, combines with spreadsheet, and then outputs a BOM with MPN. This is working very nicely for current projects (team of a couple engineers).

1 Like

What to put in the schematic? I agree that not every bit of info is usefull visible in the schema. But part library is a different. To me it needs ordering info for others to use.

It seems like we’re all reinventing the wheel!

Very nice job with your tools – first I’ve seen your project. I added a link in the GitPLM readme so I won’t lose track of it.