Compare commits

...

5 Commits

4 changed files with 123 additions and 17 deletions

View File

@ -6,11 +6,22 @@ requirements
to be able to generate the outputs, you need following software:
- [QEDA](http://qeda.org/): to generate footprints for the parts
- [KiCad](https://www.kicad.org/): EDA software used for schematic capture and board layout
- [KiCad v7](https://www.kicad.org/): EDA software used for schematic capture and board layout
- [PcbDraw](https://github.com/yaqwsx/PcbDraw): to generate board layout rendering
- [KiKit](https://github.com/yaqwsx/KiKit): to generate fabrications files (Gerber, Excellon)
- [KiAuto](https://github.com/INTI-CMNB/KiAuto): to generate schematic printout (PDF)
- [KiBoM](https://github.com/SchrodingersGat/KiBoM): to generate Bill of Material (CSV)
- [Interactive HTML BOM](https://github.com/openscopeproject/InteractiveHtmlBom): to generate placement guide
install Interactive HTML BOM using KiCad's Plugin and Content Manager.
for the others:
~~~
npm install qeda
pip install pcbdraw kibom kikit
~~~
you can additionally install KiKit using KiCad's Plugin and Content Manager for an integrated GUI.
compiling
=========

28
KiBOM_CLI.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
"""
@package
KiBOM - Bill of Materials generation for KiCad
Generate BOM in xml, csv, txt, tsv, html or xlsx formats.
- Components are automatically grouped into BoM rows (grouping is configurable)
- Component groups count number of components and list component designators
- Rows are automatically sorted by component reference(s)
- Supports board variants
Extended options are available in the "bom.ini" config file in the PCB directory
(this file is auto-generated with default options the first time the script is executed).
For usage help:
python KiBOM_CLI.py -h
"""
import sys
import os
here = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, here)
from kibom.__main__ import main # noqa: E402
main()

View File

@ -5,8 +5,10 @@ SUBSHEET ?= rsim_serial rsim_power rsim_sim rsim_esp32s2 rsim_esp32s3
KICAD = kicad-cli
# path to qeda
QEDA := qeda
# path to KiBOM
KIBOM := ./KiBOM_CLI.py
# path to InteractiveHtmlBom
IBOMGEN := /usr/share/kicad/scripting/plugins/InteractiveHtmlBom/generate_interactive_bom.py
IBOMGEN := ~/.local/share/kicad/7.0/3rdparty/plugins/org_openscopeproject_InteractiveHtmlBom/generate_interactive_bom.py
# read project version
VERSION := $(shell cat version)
@ -36,17 +38,19 @@ all: $(VERSIONED_SHEET) ${NAME}.sch.pdf ${NAME}.brd-top.png ${NAME}.brd-bot.png
fab: ${FABRICATION_DIR} ${IBOM}
# generate fabrication files (gerbers/drill/BoM/PnP)
#${FABRICATION_DIR}: ${NAME}.versioned.kicad_sch ${NAME}.versioned.kicad_pcb
# kikit fab jlcpcb --drc --assembly --schematic $^ $@
${FABRICATION_DIR}: ${NAME}.versioned.kicad_pcb
mkdir -p ${FABRICATION_DIR}
$(KICAD) pcb export gerbers --output ${FABRICATION_DIR} $<
$(KICAD) pcb export drill --output ${FABRICATION_DIR}/ $<
$(KICAD) pcb export pos --output ${FABRICATION_DIR}/${NAME}.versioned.pos $<
${FABRICATION_DIR}: ${NAME}.versioned.kicad_sch ${NAME}.versioned.kicad_pcb
kikit fab jlcpcb --drc --assembly --schematic $^ $@
# generate fabrication files (gerbers/drill/uncorrected PnP)
#${FABRICATION_DIR}: ${NAME}.versioned.kicad_pcb
# mkdir -p ${FABRICATION_DIR}
# $(KICAD) pcb export gerbers --output ${FABRICATION_DIR} $<
# $(KICAD) pcb export drill --output ${FABRICATION_DIR}/ $<
# $(KICAD) pcb export pos --output ${FABRICATION_DIR}/${NAME}.versioned.pos $<
# generate interactive BoM
${IBOM}: ${NAME}.versioned.kicad_pcb
$(IBOMGEN) --no-browser --dest-dir `dirname $@` --name-format `basename $@ ".html"` --show-fields "Value" $< &>/dev/null
python $(IBOMGEN) --no-browser --dest-dir `dirname $@` --name-format `basename $@ ".html"` --show-fields "Value" $< &>/dev/null
# generate symbols and footprints from parts
lib:
@ -70,7 +74,7 @@ lib:
# export Bill of Material (as CSV)
%.bom.csv: %.bom.xml
kibom $< $@
python $(KIBOM) $< $@
# generate panel
PANEL_DIR := panel

73
bom.ini
View File

@ -1,10 +1,37 @@
[BOM_OPTIONS]
ignore_dnf = 0
number_rows = 0
; General BoM options here
; If 'ignore_dnf' option is set to 1, rows that are not to be fitted on the PCB will not be written to the BoM file
ignore_dnf = 1
; If 'html_generate_dnf' option is set to 1, also generate a list of components not fitted on the PCB (HTML only)
html_generate_dnf = 1
; If 'use_alt' option is set to 1, grouped references will be printed in the alternate compressed style eg: R1-R7,R18
use_alt = 0
; If 'alt_wrap' option is set to and integer N, the references field will wrap after N entries are printed
alt_wrap = 0
; If 'number_rows' option is set to 1, each row in the BoM will be prepended with an incrementing row number
number_rows = 1
; If 'group_connectors' option is set to 1, connectors with the same footprints will be grouped together, independent of the name of the connector
group_connectors = 1
test_regex = 0
; If 'test_regex' option is set to 1, each component group will be tested against a number of regular-expressions (specified, per column, below). If any matches are found, the row is ignored in the output file
test_regex = 1
; If 'merge_blank_fields' option is set to 1, component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields = 1
; Specify output file name format, %O is the defined output name, %v is the version, %V is the variant name which will be ammended according to 'variant_file_name_format'.
output_file_name = %O%V
; Specify the variant file name format, this is a unique field as the variant is not always used/specified. When it is unused you will want to strip all of this.
variant_file_name_format = _(%V)
; Field name used to determine if a particular part is to be fitted
fit_field = Config
; Make a backup of the bom before generating the new one, using the following template
make_backup = %O.tmp
; Default number of boards to produce if none given on CLI with -n
number_boards = 1
; Default PCB variant if none given on CLI with -r
board_variant = ['default']
; Whether to hide headers from output file
hide_headers = False
; Whether to hide PCB info from output file
hide_pcb_info = False
[IGNORE_COLUMNS]
; Any column heading that appears here will be excluded from the Generated BoM
@ -15,6 +42,9 @@ Footprint
Footprint Lib
Build Quantity
sheetpath
qeda_part
qeda_variant
name
[COLUMN_ORDER]
; Columns will apear in the order they are listed here
@ -28,15 +58,48 @@ Part Lib
Footprint
Footprint Lib
Build Quantity
DigiKey
LCSC
JLCPCB
JLCPCB_CORRECTION
Datasheet
[GROUP_FIELDS]
; List of fields used for sorting individual components into groups
; Components which match (comparing *all* fields) will be grouped together
; Field names are case-insensitive
Part
Part Lib
Value
Footprint
Footprint Lib
[COMPONENT_ALIASES]
; A series of values which are considered to be equivalent for the part name
; Each line represents a list of equivalent component name values separated by white space
; e.g. 'c c_small cap' will ensure the equivalent capacitor symbols can be grouped together
; Aliases are case-insensitive
c c_small cap capacitor
r r_small res resistor
sw switch
l l_small inductor
zener zenersmall
d diode d_small
[REGEX_INCLUDE]
; A series of regular expressions used to include parts in the BoM
; If there are any regex defined here, only components that match against ANY of them will be included in the BOM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
[REGEX_EXCLUDE]
; A series of regular expressions used to exclude parts from the BoM
; If a component matches ANY of these, it will be excluded from the BoM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
References ^TP[0-9]*
References ^FID
Part mount.*hole
Part solder.*bridge
Part test.*point
Footprint test.*point
Footprint mount.*hole
Footprint fiducial