You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some projects that involve sockets for certain components that I want to be removable. I put these in a hierarchical sheet for which the "exclude from board" property is set. PartDB imports PCB BOMs, though, which won't include any components that were excluded from the board in the schematic.
I knocked together a little bit of Python that massages a schematic BOM (produced with the Tools -> Generate Bill of Materials... menu item in the schematic editor) into the PCB BOM format so it can be imported into PartDB.
#!/usr/bin/env python
# converts KiCad schematic BOM to PCB BOM for PartDB import
import csv
from sys import argv
with open(argv[1], newline="") as sch_bom:
dialect=csv.Sniffer().sniff(sch_bom.read(1024))
sch_bom.seek(0)
reader=csv.DictReader(sch_bom, dialect=dialect)
dest_header=["Id", "Designator", "Footprint", "Quantity", "Designation", "Supplier and ref", None]
with open(argv[2], "w", newline="") as pcb_bom:
writer=csv.writer(pcb_bom, delimiter=";", quotechar="\"", quoting=csv.QUOTE_STRINGS)
writer.writerow(dest_header)
id=1
for row in reader:
writer.writerow([id, row["Reference"], row["Footprint"].split(":")[1], row["Qty"], row["MPN"], None])
id=id+1
Perhaps a future version of PartDB might allow importing a schematic BOM directly (all of the needed information is in there), but until then, maybe others will find this useful.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have some projects that involve sockets for certain components that I want to be removable. I put these in a hierarchical sheet for which the "exclude from board" property is set. PartDB imports PCB BOMs, though, which won't include any components that were excluded from the board in the schematic.
I knocked together a little bit of Python that massages a schematic BOM (produced with the
Tools -> Generate Bill of Materials...
menu item in the schematic editor) into the PCB BOM format so it can be imported into PartDB.The script is also available from https://gitlab.alfter.us/salfter/bomfix.
Perhaps a future version of PartDB might allow importing a schematic BOM directly (all of the needed information is in there), but until then, maybe others will find this useful.
Beta Was this translation helpful? Give feedback.
All reactions