KiBot/README.md

4.2 KiB

KiPlot

KiPlot is a program which helps you to plot your KiCad PCBs to output formats easily, repeatable, and most of all, scriptably. This means you can use a Makefile to export your KiCad PCBs just as needed.

For example, it's common that you might want for each board rev:

  • Check ERC/DRC one last time (using KiCad Automation Scripts)
  • Gerbers, drills and drill maps for a fab in their favourite format
  • Fab docs for the assembler
  • Pick and place files

You want to do this in a one-touch way, and make sure everything you need to do so it securely saved in version control, not on the back of an old datasheet.

KiPlot lets you do this.

As a side effect of providing a scriptable plot driver for KiCad, KiPlot also allows functional testing of KiCad plot functions, which would otherwise be somewhat unwieldy to write.

The configuration file

Kiplot uses a configuration file where you can specify what outputs to generate. By default you'll generate all of them, but you can specify which ones from the command line.

The configuration file should be named *.kiplot.yaml. The format used is YAML. This is basically a text file with some structure.

The header

All configuration files must start with:

kiplot:
  version: 1

This tells to Kiplot that this file is using version 1 of the format.

The preflight section

This section is used to specify tasks that will executed before generating any output. The available tasks are:

  • run_erc To run the ERC (Electrical Rules Check). To ensure the schematic is electrically correct.
  • run_drc To run the DRC (Distance Rules Check). To ensure we have a valid PCB.
  • update_xml To update the XML version of the BoM (Bill of Materials). To ensure our generated BoM is up to date.

The run_drc command has the following options:

  • check_zone_fills Every time we run the DRC the zones are filled again. This option saves the PCB to disk updating the zones.
  • ignore_unconnected Ignores the unconnected nets. Useful if you didn't finish the routing.

Here is an example of a preflight section:

preflight:
  run_erc: true
  update_xml: true
  run_drc: true
  check_zone_fills: true
  ignore_unconnected: false

The outputs section

In this section you put all the things that you want to generate. This section contains one or more outputs. Each output contain the following data:

  • name a name so you can easily identify it.
  • comment a short description of this output.
  • type selects which type of output will be generated. Examples are gerbers, drill files and pick & place files
  • dir is the directory where this output will be stored.
  • options contains one or more options to configure this output.
  • layers a list of layers used for this output. Not all outputs needs this subsection.

The available values for type are:

  • Plot formats:
    • gerber the gerbers for fabrication.
    • ps postscript plot -hpgl format for laser printers
    • svg scalable vector graphics
    • pdf portable document format
    • dxf mechanical CAD format
  • Drill formats:
    • excellon data for the drilling machine
    • gerb_drill drilling positions in a gerber file
  • Pick & place
    • position of the components for the pick & place machine
  • Documentation
    • pdf_sch_print schematic in PDF format
    • pdf_pcb_printPDF file containing one or more layer and the page frame
  • Bill of Materials

Using KiPlot

You can call kiplot directly, passing a PCB file and a config file:

kiplot -b $(PCB) -c $(KIPLOT_CFG) -v

A simple target can be added to your makefile, so you can just run make pcb_files or integrate into your current build process.

pcb_files:
    kiplot -b $(PCB) -c $(KIPLOT_CFG) -v

Installing

Installation on Ubuntu/Debian:

Get the Debian package from the releases section and run:

sudo apt install ./kiplot.inti-cmnb_*_all.deb