BOM Script: a way to exclude part from BOM by custom field

Regarding these files: File1:

and File2 (+line of interest):

Also, regarding this thread: To exclude Virtual footprints from BOM [SOLVED]

What do I want: I am trying to make custom csv bom, based on File2. I want to exclude DNP (Do Not Populate) components from BOM, if component has “DNP” field and this field is not empty. All symbols on schematics have “DNP” field, and in case this field contains a value, BOM script should ignore it.

Question #1 is: Can this be done in other easy way instead of modifying File1? I mean File1 is part of kicad’s installation, why should I modify that? Nobody should temper files, created by software installer, I think. These files will probably get overwritten next time software update is available, thus causing my modifications to be lost.

Explanation:File1 is hardcoded to omit components, having field "Installed" = "NU", and I want to change this to "DNP" != "". So, I go to and append these lines there:

if c.getField( "DNP" ) != '':
exclude = True

Now my custom BOM script only prints what I needed, but accomplished this by modifying kicad installation file…

Just a note, that @qu1ck 's iBOM plugin works the same way, it has a dedicated setting for that:

It successfully omits components, with DNP field not empty from html BOM. I want to do exactly the same, but from eeschema BOM plugin.

Question #2: Maybe File1 in kicad master should be improved to be more flexible? Is this worth filling an wishlist issue in gitlab, or is it intended for users to modify File1?**

Question #3: Can this “configuration” section lines 26 to 71 be changed (overridden) from outside code? (My python knowledge is zero)

To be more clearer about q#3: iBom plugin has these blacklist configurable, it would be perfect if the same configuration options would be available from python code):

(Mentioning iBOM here a lot because it is the most valuable addition to kicad as I know…)

I have copied and to my working directory and modified them there (also renamed that bom_csv… file to something like Then in Tools-Generate BOM window I added to list of BOM plugins. KiCad remembers that it is my default so after selecting Generate BOM I have only to click [Generate] key.
That way my files are not overwritten when installing new KiCad versions, but if programmers will improve something in those files I will not get it until I will compare my files with current ones. Using new files will probably need once more to understand what and how I should modify there something. But until my files work good for me what for I should look for improvements.

1 Like

Ok, created MR for this:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.