PcbDraw allows you to convert KiCad board files into a nice looking visualizations. There are two modes of drawing the boards:
- plotting them. The result is a simplified and stylized board image. However, you have to supply hand-drawn footprint images. It can also remap symbols, easily select board style and also, render resistor values color bands.
- rendering them. This invokes
kicad-cli pcb renderto produce a 3D image of the board. Requires KiCAD 9 or newer.
Board plotting is available under the pcbdraw plot <input_file> <output_file>
command. The output file can by any of the .svg, .jpg or .png. The command
has the following options:
-s, --style TEXTname of the style or a path to a style file. Style files are explained below.-l, --libs COMMA SEPARATED LISTname of libraries that will be used for resolving the footprints. DefaultKiCAD-base.-p, --placeholdersRender placeholders to the board showing the component origins.m, --remap FILEtakes a path to a JSON file containing a dictionary from component references to alternative modules to change a module for given component. This allows you to e.g. choose different colors for LEDs without a need to change original board and create new packages for different colors. Format of dictionary entry is"<ref>": "<library>:<module>"- e.g."PHOTO1": "Resistors:R_PHOTO_7mm".--drill-holes / --no-drill-holesMake drill holes transparent--side [front|back]Specify which side of the PCB to render--mirrorMirror the board--highlight COMMA SEPARATED LISTComma separated list of component designators to highlight-f, --filter COMMA SEPARATED LISTComma separated list of component designators to show, if not specified, show all-v, --vcuts KICAD LAYERIf layer is specified, renders V-cuts from it--resistor-values COMMA SEPARATED LISTComma separated colon delimited key-value pairs for manually setting a resistor's value, used for through-hole resistors's band. For example,R1:10k,R2:470 1%.--resistor-flip COMMA SEPARATED LISTComma separated list of resistor designators whose bands to flip.--pasteRender paste layer--components / --no-componentsRender components--outline-width FLOATOutline width of the board substrate in mm--dpi INTEGERDPI for bitmap output--margin INTEGERSpecify margin of the final image in millimeters--silentDo not output any warnings--werrorTreat warnings as errors--show-lib-pathsShow library paths and quit.
The styles can be installed in various locations. PcbDraw will look for them in the following places (in the order as specified):
- if the name matches existing file, it will be use (i.e., the name is path)
- built-in styles and libraries distributed with the PcbDraw.
- the user local data directory. The script adds
share/pcbdraw. As an example, on Linux systems the path for styles will be:~/.local/share/pcbdraw/styles - the system data directory. The script adds
share/pcbdraw. As an example, on Linux systems the path for styles will be:/usr/share/pcbdraw/styles
The exact paths used on your system are displayed when you add
--show-lib-paths to you command.
By convention, footprint libraries can be inside footprints subdirectory and
styles inside styles subdirectory.
Style is a JSON file contain color definitions for the board substrate (they don't have any effect on modules):
{
"clad": "#9c6b28",
"copper": "#417e5a",
"board": "#4ca06c",
"silk": "#f0f0f0",
"pads": "#b5ae30",
"outline": "#000000",
"highlight-on-top": false,
"highlight-style": "stroke:none;fill:#ff0000;opacity:0.5;",
"highlight-padding": 1.5,
"highlight-offset": 0
}
Colors are in HEX format, names of the colors should be self descriptive.
The footprint library has a separate documentation page.
Board rendering is available under the pcbdraw render <input_file> <output_file>
command. It uses kicad-cli pcb render to produce 3D images of the board. The
output file should be .png (supports transparency) or .jpg. The command has
the following options:
--side [front|back]Specify which side to render--renderer [raytrace|normal]Specify what renderer to use--projection [orthographic|perspective]Specify projection--transparentMake transparent background of the image--padding INTEGERPadding around the board after cropping, in pixels--width INTEGERRender canvas width in pixels (before cropping)--height INTEGERRender canvas height in pixels (before cropping)
The component 3D models are taken from the board settings and KiCAD parameters. The board thickness and color is also taken from the board file. The rendered image is automatically cropped to the board bounds.
Rendering works on all platforms where kicad-cli is available (Linux, macOS,
Windows). Requires KiCAD 9 or newer.