I’ve been searching the forum for an hour now and cannot seem to find a solution.
I have multi-page project which consists of 9 different pages and 3 PCBs. I’d like to create 3 separate BOMs for 3 PCBs as these will be handled differently.
Motherboard PCB is contained on 7 pages of schematic and 2 pages are separate PCBs.
All parts on all pages are prefixed with page numbers (eg. resistors on page 5 are all numbered R500, R501, R502… etc…)
Is there a way I can exclude a page while generating BOM? Did someone already generated a script with that functionality?
If not it seems that I might have to write it myself.
I managed to hack something quickly just by adding below 3 lines to bom_csv_grouped_by_value.py script in /usr/share/kicad/plugins
# Output all the interesting components individually first:
row = []
for c in components:
# Added: do not add components from pages 5 and 7
if re.match(r'^\D{1,3}[5|7]\d+', c.getRef()):
print('Removed: ', c.getRef())
continue
#################
del row[:]
row.append('') # item is blank in individual table
row.append('') # Qty is always 1, why print it
...........
OK
I’ve found even better place for placing regex for references that need to be excluded.
This is in kicad_netlist_reader.py file in /usr/share/kicad/plugins directory.
I needed to read trough comments to figure it out. There is a variable called excluded_references and I just added regex for all components that I wanted to skip.
# regular expressions which match component 'Reference' fields of components that
# are to be excluded from the BOM.
excluded_references = [
'TP[0-9]+', # all test points
'^\D{1,3}[5,7]\d+', # Pages 5 and 7
'^FID.+', # Fiducials
'^JP\d+', # Jumpers
'^H\d+' # Mounting holes
]
More advanced BOM generators like KiBom can recognize board variant field which will let you generate separate BOMs for your motherboard and daughterboards.