On This Page (11)
kcr toon
Generate shaded top and bottom PCB illustration SVGs with board-aware 3D STEP model clipping, soldermask themes, and optional assembly designators.
| Command | Aliases | Category | Runtime | Config | Guide |
|---|---|---|---|---|---|
kcr toon | — | PCB Visualization & Design Review | Python kcr + Native Rust k3 | <board_dir>/toon.config (kicad_cruncher.pcb_svg.config.a0 Toon preset, auto-created if missing; inherits sibling fab.jsonc) | Rendering & Design Review: kcr toon |
Usage
kcr toon [-h] [-o OUTPUT] [--side {top,bottom,both}]
[--footprint FOOTPRINT] [--assembly] [--doc PCBDOC]
[--variant VARIANT | --all-variants]
[--theme {saved,white,black,blue,red,purple,yellow,green} |
--soldermask-color SOLDERMASK_COLOR]
[--config CONFIG] [--write-config WRITE_CONFIG]
[--embedded-only] [--workers WORKERS]
[--cache-dir CACHE_DIR | --no-cache]
[--timings TIMINGS] [--no-color]
[file]Native Rust CLI Equivalent (k3)
Implemented natively in k3 on top of kicad-monkey-fab with solder-mask themes (saved, white, black, blue, red, purple, yellow, green), variant DNP filtering, and persistent .kcr/cache caching.
k3 toon [-o OUTPUT] [--doc BOARD] [--side {top,bottom,both}] [--assembly] [--footprint REF] [--variant NAME | --all-variants] [--theme THEME | --soldermask-color #RRGGBB] [--embedded-only] [--config PATH] [--write-config PATH] [--workers N] [--cache-dir PATH | --no-cache] [--timings PATH] [file]Positional Arguments
| Argument | Description |
|---|---|
file | KiCad board or project (auto-detects a single project in CWD) |
Options
| Flag | Description |
|---|---|
-o, --output OUTPUT | Output directory (default: ./output/toon) |
--side SIDE | Board side(s) to render (default: all enabled views in config). Choices: top, bottom, both. |
--footprint FOOTPRINT | Render a single footprint by reference designator (drops board-level layers) |
--assembly | Overlay assembly designators on top of shaded 3D component art |
--doc, --pcbdoc PCBDOC | Select a specific .kicad_pcb board filename or stem inside a project |
--variant VARIANT | Render a single named assembly variant from .kicad_pro. Mutually exclusive with --all-variants. |
--all-variants | Render every assembly variant declared in .kicad_pro. Mutually exclusive with --variant. |
--theme THEME | Built-in soldermask/silkscreen color preset (overrides config mask & silk colors). Choices: saved, white, black, blue, red, purple, yellow, green. Mutually exclusive with --soldermask-color. |
--soldermask-color SOLDERMASK_COLOR | Explicit soldermask color ('auto' or #RRGGBB) with auto-contrasting silkscreen. Mutually exclusive with --theme. |
--config CONFIG | Path to toon.config JSON/JSONC file (default: <board_dir>/toon.config) |
--write-config WRITE_CONFIG | Write the resolved toon.config JSON file and exit without rendering |
--embedded-only | Resolve only kicad-embed:// STEP models; skip external KiCad library paths |
--workers WORKERS | Parallel Geometer worker count (1-64, default: 4) |
--cache-dir CACHE_DIR | Persistent cache directory (default: .kcr/cache beside the project or board). Mutually exclusive with --no-cache. |
--no-cache | Disable the persistent cache; reuse within this run remains. Mutually exclusive with --cache-dir. |
--timings TIMINGS | Write a JSON timing breakdown report to this file path |
--no-color | Disable ANSI colors and animated spinners |
Visual Samples
Rendered directly from the bundled virtual_fab_layers.kicad_pcb board (34 parts, 24 embedded 3D STEP models, 7 board cutouts) with kcr toon — click Open SVG or toggle Paper / Dark to inspect the vector linework up close. Any KiCad board with embedded or external STEP models can be rendered the same way:
kcr toon virtual_fab_layers.kicad_pcb --side top --theme green -o output/toonWith --theme black --assembly, kcr toon switches solder-mask/silkscreen contrast automatically and injects fitted ASSEMBLY_DESIGNATORS_TOP labels directly above the 3D component illustrations:
kcr toon virtual_fab_layers.kicad_pcb --side top --theme black --assembly -o output/toonHow It Works
kcr toon is a turnkey illustrated PCB preset built directly on the kcr pcb-svg compositor (kicad_cruncher.pcb_svg.config.a0). It layers substrate, solder-mask film, copper, drills, slots, silkscreen, and shaded 3D STEP component illustrations (ILLUSTRATION_TOP / ILLUSTRATION_BOTTOM), frames tightly to board bounds (+1 mm margin, or +3 mm in --footprint mode), and publishes atomically into -o <dir> (default ./output/toon) alongside manifest.json.
Unlike kcr pcb-svg, kcr toon does not write generated per-board components entries into toon.config; instead, it applies the board's assembly part rules (component_entries(pcb)) in memory beneath config.components so toon.config stays clean and portable across boards.
Input & Config Discovery
- Input resolution:
- Accepts
.kicad_pcbor.kicad_pro. If omitted, auto-detects a single*.kicad_proin CWD, falling back to a single*.kicad_pcb. - If you pass a
.kicad_pcband--doc <name>,--docmust match that board's filename or stem; otherwisekcr toonaborts with an error.
- Accepts
toon.configdiscovery & auto-creation:--write-config <PATH>resolves the built-in Toon preset + optional--configoverlay +--theme/--soldermask-color, writes the resolved JSON to<PATH>, and exits immediately without loading any board.- During a normal render,
kcr toonuses--config <path>or defaults to<board_dir>/toon.config. - If that config file does not exist yet,
kcr toonauto-creates it with the resolved defaults (including any--themeor--soldermask-coloractive on that first run).
- Sibling
fab.jsoncvirtual_layersinheritance:- Like
kcr pcb-svg, Pythonkcr tooninherits a sibling<board_dir>/fab.jsonc"virtual_layers"policy read-only (stripping Gerber-only family*.enabledtoggles).
- Like
Solder-Mask Themes
Theme (--theme) | Solder-Mask Film | Silkscreen |
|---|---|---|
saved (default) | auto (from KiCad board stackup) | #F5F5F5 |
green | #176B3A | #F5F5F5 |
black | #000000 | #F5F5F5 |
white | #EEEEEE | #000000 |
blue | #1D4F91 | #F5F5F5 |
red | #A62A2A | #F5F5F5 |
purple | #6F3C8A | #F5F5F5 |
yellow | #D6A600 | #F5F5F5 |
Precedence & Conflict Rules
--themevs--soldermask-color(mutually exclusive):- Passing both fails at argument parsing.
--soldermask-coloracceptsautoor#RRGGBBand sets silkscreen to"contrast".- Whichever flag is passed overwrites
soldermask_film.colorand all three silkscreen style colors (silkscreen_component_graphics,silkscreen_designators,silkscreen_board_graphics) across bothglobal.stylesand everyviews[].stylesentry that defines astylesobject.
--variantvs--all-variants(mutually exclusive; require.kicad_pro):- Both flags require a
.kicad_pro(either passed directly or auto-discovered as a sibling<board>.kicad_pro). Running either against a standalone.kicad_pcbwithout a sibling.kicad_profails with an error. - Unknown
--variantnames fail fast (unlikekcr bom/pnp/jlcwhich warn). When variant flags are used, each variant renders into its own subdirectory under-o.
- Both flags require a
--footprint <REF>vs--side& board-layer stripping:--footprint <REF>must match exactly one footprint on the board.- If
--side topor--side bottomis also passed and does not match the footprint's mounted side,kcr toonaborts with an error (footprint is outside requested --side). - One-footprint views automatically strip board-level tokens (
BOARD_SUBSTRATE,SOLDERMASK_FILM_*,BOARD_CUTOUTS,BOARD_OUTLINE) and board-level graphics/tracks/zones, framing with a 3 mm margin around the isolated part.
--assemblylayer injection:- Injects
ASSEMBLY_DESIGNATORS_TOP(or_BOTTOM) immediately afterILLUSTRATION_TOP(or_BOTTOM) in the view's token list if not already present — ensuring designators draw crisply on top of 3D component bodies.
- Injects
- View uniqueness & strict boolean validation:
- Each requested side (
top,bottom) must resolve to at most one enabled view (matched by view nametop/toon_top/toon-topor side tokens); multiple enabled views for the same side fail with an error, and zero enabled views also fail. - Unlike
kcr pcb-svg's permissive boolean coercion,toon.configenforces strict JSON booleans (true/false, never0/1/strings) forenabled,mirror, andmirror_bottom_view.
- Each requested side (
- Path-containment safety guards:
-o/--outputmust not contain the input board, project,toon.config, or cache directory.--configmust not point to the board or project file itself.--timings <PATH>must be a separate file path outside-o, inputs, and cache directories.--workersis bounded to1..64(default4);--cache-dirand--no-cacheare mutually exclusive;--embedded-only(orKCR_EMBEDDED_MODELS_ONLY=1) restricts 3D STEP resolution tokicad-embed://payloads only (see Embedding 3D STEP Models).
Quick Examples
# Render shaded top and bottom illustrated PCB SVGs
kcr toon board.kicad_pcb -o output/toon# Render top view with a green solder-mask theme and assembly designators
kcr toon board.kicad_pcb --side top --theme green --assembly -o output/toon# Render a single footprint with board layers dropped
kcr toon board.kicad_pcb --footprint U1 -o output/toon# Strict embedded-only mode (for CI portability checks)
kcr toon board.kicad_pcb --embedded-only -o output/toon