kicad monkey v2026.11.30
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.

CommandAliasesCategoryRuntimeConfigGuide
kcr toon—PCB Visualization & Design ReviewPython 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

sh
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.

sh
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

ArgumentDescription
fileKiCad board or project (auto-detects a single project in CWD)

Options

FlagDescription
-o, --output OUTPUTOutput directory (default: ./output/toon)
--side SIDEBoard side(s) to render (default: all enabled views in config). Choices: top, bottom, both.
--footprint FOOTPRINTRender a single footprint by reference designator (drops board-level layers)
--assemblyOverlay assembly designators on top of shaded 3D component art
--doc, --pcbdoc PCBDOCSelect a specific .kicad_pcb board filename or stem inside a project
--variant VARIANTRender a single named assembly variant from .kicad_pro. Mutually exclusive with --all-variants.
--all-variantsRender every assembly variant declared in .kicad_pro. Mutually exclusive with --variant.
--theme THEMEBuilt-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_COLORExplicit soldermask color ('auto' or #RRGGBB) with auto-contrasting silkscreen. Mutually exclusive with --theme.
--config CONFIGPath to toon.config JSON/JSONC file (default: <board_dir>/toon.config)
--write-config WRITE_CONFIGWrite the resolved toon.config JSON file and exit without rendering
--embedded-onlyResolve only kicad-embed:// STEP models; skip external KiCad library paths
--workers WORKERSParallel Geometer worker count (1-64, default: 4)
--cache-dir CACHE_DIRPersistent cache directory (default: .kcr/cache beside the project or board). Mutually exclusive with --no-cache.
--no-cacheDisable the persistent cache; reuse within this run remains. Mutually exclusive with --cache-dir.
--timings TIMINGSWrite a JSON timing breakdown report to this file path
--no-colorDisable 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:

toon_sample_top_green.svg
Open SVG
kcr toon --side top --theme green
sh
kcr toon virtual_fab_layers.kicad_pcb --side top --theme green -o output/toon

With --theme black --assembly, kcr toon switches solder-mask/silkscreen contrast automatically and injects fitted ASSEMBLY_DESIGNATORS_TOP labels directly above the 3D component illustrations:

toon_sample_top_black_assembly.svg
Open SVG
kcr toon --side top --theme black --assembly
sh
kcr toon virtual_fab_layers.kicad_pcb --side top --theme black --assembly -o output/toon

How 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

  1. Input resolution:
    • Accepts .kicad_pcb or .kicad_pro. If omitted, auto-detects a single *.kicad_pro in CWD, falling back to a single *.kicad_pcb.
    • If you pass a .kicad_pcb and --doc <name>, --doc must match that board's filename or stem; otherwise kcr toon aborts with an error.
  2. toon.config discovery & auto-creation:
    • --write-config <PATH> resolves the built-in Toon preset + optional --config overlay + --theme/--soldermask-color, writes the resolved JSON to <PATH>, and exits immediately without loading any board.
    • During a normal render, kcr toon uses --config <path> or defaults to <board_dir>/toon.config.
    • If that config file does not exist yet, kcr toon auto-creates it with the resolved defaults (including any --theme or --soldermask-color active on that first run).
  3. Sibling fab.jsonc virtual_layers inheritance:
    • Like kcr pcb-svg, Python kcr toon inherits a sibling <board_dir>/fab.jsonc "virtual_layers" policy read-only (stripping Gerber-only family *.enabled toggles).

Solder-Mask Themes

Theme (--theme)Solder-Mask FilmSilkscreen
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

  1. --theme vs --soldermask-color (mutually exclusive):
    • Passing both fails at argument parsing.
    • --soldermask-color accepts auto or #RRGGBB and sets silkscreen to "contrast".
    • Whichever flag is passed overwrites soldermask_film.color and all three silkscreen style colors (silkscreen_component_graphics, silkscreen_designators, silkscreen_board_graphics) across both global.styles and every views[].styles entry that defines a styles object.
  2. --variant vs --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_pcb without a sibling .kicad_pro fails with an error.
    • Unknown --variant names fail fast (unlike kcr bom/pnp/jlc which warn). When variant flags are used, each variant renders into its own subdirectory under -o.
  3. --footprint <REF> vs --side & board-layer stripping:
    • --footprint <REF> must match exactly one footprint on the board.
    • If --side top or --side bottom is also passed and does not match the footprint's mounted side, kcr toon aborts 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.
  4. --assembly layer injection:
    • Injects ASSEMBLY_DESIGNATORS_TOP (or _BOTTOM) immediately after ILLUSTRATION_TOP (or _BOTTOM) in the view's token list if not already present — ensuring designators draw crisply on top of 3D component bodies.
  5. View uniqueness & strict boolean validation:
    • Each requested side (top, bottom) must resolve to at most one enabled view (matched by view name top/toon_top/toon-top or 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.config enforces strict JSON booleans (true/false, never 0/1/strings) for enabled, mirror, and mirror_bottom_view.
  6. Path-containment safety guards:
    • -o / --output must not contain the input board, project, toon.config, or cache directory.
    • --config must not point to the board or project file itself.
    • --timings <PATH> must be a separate file path outside -o, inputs, and cache directories.
    • --workers is bounded to 1..64 (default 4); --cache-dir and --no-cache are mutually exclusive; --embedded-only (or KCR_EMBEDDED_MODELS_ONLY=1) restricts 3D STEP resolution to kicad-embed:// payloads only (see Embedding 3D STEP Models).

Quick Examples

sh
# Render shaded top and bottom illustrated PCB SVGs
kcr toon board.kicad_pcb -o output/toon
sh
# 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
sh
# Render a single footprint with board layers dropped
kcr toon board.kicad_pcb --footprint U1 -o output/toon
sh
# Strict embedded-only mode (for CI portability checks)
kcr toon board.kicad_pcb --embedded-only -o output/toon
kicad-monkey v2026.11.30·Docs updated 2026.12.01 15:43 UTC (fd9b75b)