Skip to content
qu1ck edited this page Nov 21, 2018 · 17 revisions

You can use this plugin as installed Pcbnew Action Plugin or from command line as a standalone script.

Installed plugin

Open Pcbnew. Draw your board, make sure it has edges drawn on Edge.Cuts layer.

Save the file and press the iBOM button on the top toolbar.

If the button is not on the toolbar Tools -> External Plugins... -> Generate Interactive HTML BOM also works. Note that this menu is only present on builds that have KICAD_SCRIPTING_ACTION_MENU option turned on. In recent nightly builds you can choose to hide the plugin button in pcbnew preferences.

After launching the plugin a settings dialog will appear. Set your preferences and click Generate BOM. That will generate bom html page in the directory you chose.

If you don't want to configure the plugin every time you run it click Save settings after you've done it once and all the settings will be stored and will apply next time you use the plugin.

Standalone script

On Linux simply run this in terminal:

python2 path/to/InteractiveHtmlBom/generate_interactive_bom.py path/to/board.kicad_pcb

On windows the trick is to use python that is bundled with KiCad so the command will look like this:

path/to/kicad/bin/python.exe .../generate_interactive_bom.py .../board.kicad_pcb

All of the options that are configurable from the plugin settings dialog are also available from command line. You can also make the configuration dialog show up by running the script with --show-dialog flag. Run the script with --help flag to see all the options.

This is the output of --help flag as of editing this page:

usage: generate_interactive_bom.py [-h] [--show-dialog] [--dark-mode]
                                   [--hide-silkscreen] [--highlight-pin1]
                                   [--no-redraw-on-drag]
                                   [--board-rotation BOARD_ROTATION]
                                   [--checkboxes CHECKBOXES]
                                   [--bom-view {bom-only,left-right,top-bottom}]
                                   [--layer-view {F,FB,B}] [--no-browser]
                                   [--dest-dir DEST_DIR]
                                   [--sort-order SORT_ORDER]
                                   [--blacklist BLACKLIST]
                                   [--no-blacklist-virtual]
                                   [--netlist-file NETLIST_FILE]
                                   [--extra-fields EXTRA_FIELDS]
                                   [--variant-field VARIANT_FIELD]
                                   [--variants-whitelist VARIANTS_WHITELIST [VARIANTS_WHITELIST ...]]
                                   [--variants-blacklist VARIANTS_BLACKLIST [VARIANTS_BLACKLIST ...]]
                                   [--dnp-field DNP_FIELD]
                                   file

KiCad InteractiveHtmlBom plugin CLI.

positional arguments:
  file                  KiCad PCB file

optional arguments:
  -h, --help            show this help message and exit
  --show-dialog         Shows config dialog. All other flags will be ignored.
                        (default: False)
  --dark-mode           Default to dark mode. (default: False)
  --hide-silkscreen     Hide silkscreen by default. (default: False)
  --highlight-pin1      Highlight pin1 by default. (default: False)
  --no-redraw-on-drag   Do not redraw pcb on drag by default. (default: False)
  --board-rotation BOARD_ROTATION
                        Board rotation in degrees (-180 to 180). Will be
                        rounded to multiple of 5. (default: 0)
  --checkboxes CHECKBOXES
                        Comma separated list of checkbox columns. (default:
                        Sourced,Placed)
  --bom-view {bom-only,left-right,top-bottom}
                        Default BOM view. (default: left-right)
  --layer-view {F,FB,B}
                        Default layer view. (default: FB)
  --no-browser          Do not launch browser. (default: False)
  --dest-dir DEST_DIR   Destination directory for bom file relative to pcb
                        file directory. (default: bom)
  --sort-order SORT_ORDER
                        Default sort order for components. Must contain "~"
                        once. (default:
                        C,R,L,D,U,Y,X,F,SW,A,~,HS,CNN,J,P,NT,MH)
  --blacklist BLACKLIST
                        List of comma separated blacklisted components or
                        prefixes with *. E.g. "X1,MH*" (default: )
  --no-blacklist-virtual
                        Do not blacklist virtual components. (default: False)
  --netlist-file NETLIST_FILE
                        Path to netlist or xml file. (default: None)
  --extra-fields EXTRA_FIELDS
                        Comma separated list of extra fields to pull from
                        netlist or xml file. (default: )
  --variant-field VARIANT_FIELD
                        Name of the extra field that stores board variant for
                        component. (default: None)
  --variants-whitelist VARIANTS_WHITELIST [VARIANTS_WHITELIST ...]
                        List of board variants to include in the BOM.
                        (default: )
  --variants-blacklist VARIANTS_BLACKLIST [VARIANTS_BLACKLIST ...]
                        List of board variants to exclude from the BOM.
                        (default: )
  --dnp-field DNP_FIELD
                        Name of the extra field that indicates do not populate
                        status. Components with this field not empty will be
                        blacklisted. (default: )

BOM page mouse actions

These are some less obvious things you can do with the generate BOM html page.

You can pan the pcb drawings by dragging with left mouse button, zoom using mouse wheel and reset view by right click.

Left click on a component drawing will highlight corresponding component group, unless it is currently filtered out by filter or reference lookup fields. If there are multiple components under mouse cursor, subsequent clicks will cycle through possible interpretations.

Clicking on Copy bom table to clipboard button (located to the right of filter field above the bom table) will copy tab separated values into clipboard. You can simply paste that data into Excel/Calc/Google sheets or any other spreadsheet software.

BOM keyboard shortcuts

Html page supports keyboard shortcuts to perform most tasks:

  • ArrowUp / ArrowDown scroll through the bom table
  • Alt-R focuses reference lookup field
  • Alt-F focuses filter field
  • Alt-Z switches to bom only view
  • Alt-X switches to bom left, drawings right view
  • Alt-C switches to bom top, drawings bot view
  • Alt-V switches to front only view
  • Alt-B switches to front and back view
  • Alt-N switches to back only view
  • Alt-1 through Alt-9 toggle corresponding checkbox for highlighted bom row (if it exists)
  • N ticks the Placed checkbox if it exists and moves the highlight to next row in the bom table
Clone this wiki locally