PcbDraw - Beautiful 2D PCB render

Exports the PCB as a 2D model (SVG, PNG or JPG). Uses configurable colors.
Can also render the components if the 2D models are available.
Note that this output is fast for simple PCBs, but becomes useless for huge ones.
You can easily create very complex PCBs using the panelize output.
In this case you can use other outputs, like render_3d, which are slow for small PCBs but can handle big ones

Type: pcbdraw

Category: PCB/docs

Parameters:

  • comment : [string=’’] A comment for documentation purposes. It helps to identify the output.

  • dir : [string=’./’] Output directory for the generated files. If it starts with + the rest is concatenated to the default dir.

  • name : [string=’’] Used to identify this particular output definition. Avoid using _ as first character. These names are reserved for KiBot.

  • options : [dict] Options for the pcbdraw output.

    • Valid keys:

      • bottom : [boolean=false] Render the bottom side of the board (default is top side).

      • format : [string=’svg’] [svg,png,jpg,bmp] Output format. Only used if no output is specified.

      • mirror : [boolean=false] Mirror the board.

      • output : [string=’%f-%i%I%v.%x’] Name for the generated file. Affected by global options.

      • show_components : [list(string)|string=none] [none,all] List of components to draw, can be also a string for none or all. The default is none. There two ways of using this option, please consult the add_to_variant option. You can use _kf(FILTER) as an element in the list to get all the components that pass the filter. You can even use _kf(FILTER1;FILTER2) to concatenate filters.

      • style : [string|dict] PCB style (colors). An internal name, the name of a JSON file or the style options.

        • Valid keys:

          • board : [string=’#208b47’] Color for the board without copper (covered by solder mask).

          • clad : [string=’#cabb3e’] Color for the PCB core (not covered by solder mask).

          • copper : [string=’#285e3a’] Color for the copper zones (covered by solder mask).

          • outline : [string=’#000000’] Color for the outline.

          • pads : [string=’#8b898c’] Color for the exposed pads (metal finish).

          • silk : [string=’#d5dce4’] Color for the silk screen.

          • highlight_on_top : [boolean=false] Highlight over the component (not under).

          • highlight_padding : [number=1.5] [0,1000] How much the highlight extends around the component [mm].

          • highlight_style : [string=’stroke:none;fill:#ff0000;opacity:0.5;’] SVG code for the highlight style.

          • vcut : [string=’#bf2600’] Color for the V-CUTS.

      • add_to_variant : [boolean=true] The show_components list is added to the list of components indicated by the variant (fitted and not excluded). This is the old behavior, but isn’t intuitive because the show_components meaning changes when a variant is used. In this mode you should avoid using show_components and variants. To get a more coherent behavior disable this option, and none will always be none. Also all will be what the variant says.

      • dnf_filter : [string|list(string)=’_none’] Name of the filter to mark components as not fitted. A short-cut to use for simple cases where a variant is an overkill.

      • dpi : [number=300] [10,1200] Dots per inch (resolution) of the generated image.

      • highlight : [list(string)=[]] List of components to highlight. Filter expansion is also allowed here, see show_components.

      • libs : [list(string)=[]] List of libraries.

      • margin : [number|dict] Margin around the generated image [mm]. Using a number the margin is the same in the four directions.

        • Valid keys:

          • bottom : [number=0] Bottom margin [mm].

          • left : [number=0] Left margin [mm].

          • right : [number=0] Right margin [mm].

          • top : [number=0] Top margin [mm].

      • no_drillholes : [boolean=false] Do not make holes transparent.

      • outline_width : [number=0.15] [0,10] Width of the trace to draw the PCB border [mm]. Note this also affects the drill holes.

      • placeholder : [boolean=false] Show placeholder for missing components.

      • pre_transform : [string|list(string)=’_none’] Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill.

      • remap : [dict|None] (DEPRECATED) Replacements for PCB references using specified components (lib:component). Use remap_components instead.

      • remap_components : [list(dict)] Replacements for PCB references using specified components. Replaces remap with type check.

        • Valid keys:

          • comp : [string=’’] Component to use (from lib).

          • component : Alias for comp.

          • lib : [string=’’] Library to use.

          • library : Alias for lib.

          • ref : [string=’’] Reference for the component to change.

          • reference : Alias for ref.

      • resistor_flip : [string|list(string)=’’] List of resistors to flip its bands.

      • resistor_remap : [list(dict)] List of resistors to be remapped. You can change the value of the resistors here.

        • Valid keys:

          • ref : [string=’’] Reference for the resistor to change.

          • reference : Alias for ref.

          • val : [string=’’] Value to use for ref.

          • value : Alias for val.

      • show_solderpaste : [boolean=true] Show the solder paste layers.

      • size_detection : [string=’kicad_edge’] [kicad_edge,kicad_all,svg_paths] Method used to detect the size of the resulting image. The kicad_edge method uses the size of the board as reported by KiCad, components that extend beyond the PCB limit will be cropped. You can manually adjust the margins to make them visible. The kicad_all method uses the whole size reported by KiCad. Usually includes extra space. The svg_paths uses all visible drawings in the image. To use this method you must install the numpy Python module (may not be available in docker images).

      • svg_precision : [number=4] [3,6] Scale factor used to represent 1 mm in the SVG (KiCad 6). The value is how much zeros has the multiplier (1 mm = 10 power svg_precision units). Note that for an A4 paper Firefox 91 and Chrome 105 can’t handle more than 5.

      • variant : [string=’’] Board variant to apply.

      • vcuts : [boolean=false] Render V-CUTS on the vcuts_layer layer.

      • vcuts_layer : [string=’Cmts.User’] Layer to render the V-CUTS, only used when vcuts is enabled. Note that any other content from this layer will be included.

      • warnings : [string=’visible’] [visible,all,none] Using visible only the warnings about components in the visible side are generated.

  • type : ‘pcbdraw’

  • category : [string|list(string)=’’] The category for this output. If not specified an internally defined category is used. Categories looks like file system paths, i.e. PCB/fabrication/gerber. The categories are currently used for navigate_results.

  • disable_run_by_default : [string|boolean] Use it to disable the run_by_default status of other output. Useful when this output extends another and you don’t want to generate the original. Use the boolean true value to disable the output you are extending.

  • extends : [string=’’] Copy the options section from the indicated output. Used to inherit options from another output of the same type.

  • groups : [string|list(string)=’’] One or more groups to add this output. In order to catch typos we recommend to add outputs only to existing groups. You can create an empty group if needed.

  • output_id : [string=’’] Text to use for the %I expansion content. To differentiate variations of this output.

  • priority : [number=50] [0,100] Priority for this output. High priority outputs are created first. Internally we use 10 for low priority, 90 for high priority and 50 for most outputs.

  • run_by_default : [boolean=true] When enabled this output will be created when no specific outputs are requested.