kicad monkey v2026.11.30
On This Page (31)

Plotter IR & SVG Rendering

KiCad Plotter IR documents, records, operations, and oracle-matched SVG rendering.

31 public symbols.

KiCadPlotterDocument

class
from kicad_monkey import KiCadPlotterDocument
class KiCadPlotterDocument(records: 'list[KiCadPlotterRecord]' = <factory>, source_path: 'str | None' = None, source_kind: 'str' = 'SCH', generated_utc: 'str | None' = None, document_id: 'str | None' = None, canvas: 'dict[str, Any] | None' = None, coordinate_space: 'dict[str, Any] | None' = None, background_color: 'str | None' = None, render_hints: 'dict[str, Any] | None' = None, extras: 'dict[str, Any]' = <factory>) -> 'None'

Top-level IR document. JSON-serializable; round-trippable via
:meth:`from_dict` / :meth:`to_dict`.

Members (6)
MemberKindSignatureSummary
from_dictclassmethod(cls, data: 'dict[str, Any]') -> 'KiCadPlotterDocument'
from_fileclassmethod(cls, path: 'str | Path') -> 'KiCadPlotterDocument'
to_dictmethod(self) -> 'dict[str, Any]'
to_normalized_dictmethod(self, *, source_path: 'str | None' = None) -> 'dict[str, Any]'Drop non-deterministic fields (``generated_utc``) and normalise
write_jsonmethod(self, path: 'str | Path') -> 'Path'
write_normalized_jsonmethod(self, path: 'str | Path', *, source_path: 'str | None' = None) -> 'Path'

KiCadPlotterOp

class
from kicad_monkey import KiCadPlotterOp
class KiCadPlotterOp(kind: 'KiCadPlotterOpKind | str', payload: 'dict[str, Any]' = <factory>) -> 'None'

One PLOTTER call recorded in JSON-safe form.

``kind`` is a :class:`KiCadPlotterOpKind` for the well-known set,
or a raw ``str`` for forward-compat with future PLOTTER virtuals.

``payload`` contains only JSON-serializable primitives
(``int``/``float``/``str``/``bool``/``None``/``list``/``dict``).
Coordinates are in KiCad internal units (nm). Angles are degrees
(float).

Members (29)
MemberKindSignatureSummary
arc_center_angleclassmethod(cls, *, cx: 'float', cy: 'float', start_angle_deg: 'float', sweep_deg: 'float', radius_nm: 'float', fill: 'KiCadFillType | str' = <KiCadFillType.NO_FILL: 'NO_FILL'>, width_nm: 'int' = 0) -> 'KiCadPlotterOp'
arc_three_pointclassmethod(cls, *, start_x: 'float', start_y: 'float', mid_x: 'float', mid_y: 'float', end_x: 'float', end_y: 'float', fill: 'KiCadFillType | str' = <KiCadFillType.NO_FILL: 'NO_FILL'>, width_nm: 'int' = 0) -> 'KiCadPlotterOp'
bezier_curveclassmethod(cls, *, start_x: 'int', start_y: 'int', ctrl1_x: 'int', ctrl1_y: 'int', ctrl2_x: 'int', ctrl2_y: 'int', end_x: 'int', end_y: 'int', tolerance_nm: 'int' = 0, width_nm: 'int' = 0) -> 'KiCadPlotterOp'
circleclassmethod(cls, *, cx: 'int', cy: 'int', diameter_nm: 'int', fill: 'KiCadFillType | str' = <KiCadFillType.NO_FILL: 'NO_FILL'>, width_nm: 'int' = 0) -> 'KiCadPlotterOp'
end_blockclassmethod(cls) -> 'KiCadPlotterOp'
end_plotclassmethod(cls) -> 'KiCadPlotterOp'
flash_pad_circleclassmethod(cls, *, x: 'int', y: 'int', diameter_nm: 'int') -> 'KiCadPlotterOp'
flash_pad_customclassmethod(cls, *, x: 'int', y: 'int', size_x_nm: 'int', size_y_nm: 'int', orient_deg: 'float', polygons: 'list[list[list[int]]]', polygon_widths_nm: 'list[int] | None' = None, anchor_shape: 'str | None' = None) -> 'KiCadPlotterOp'
flash_pad_ovalclassmethod(cls, *, x: 'int', y: 'int', size_x_nm: 'int', size_y_nm: 'int', orient_deg: 'float') -> 'KiCadPlotterOp'
flash_pad_rectclassmethod(cls, *, x: 'int', y: 'int', size_x_nm: 'int', size_y_nm: 'int', orient_deg: 'float') -> 'KiCadPlotterOp'
flash_pad_roundrectclassmethod(cls, *, x: 'int', y: 'int', size_x_nm: 'int', size_y_nm: 'int', corner_radius_nm: 'int', orient_deg: 'float') -> 'KiCadPlotterOp'
flash_pad_trapezclassmethod(cls, *, x: 'int', y: 'int', corners: 'list[tuple[int, int]] | list[list[int]]', orient_deg: 'float') -> 'KiCadPlotterOp'
flash_reg_polygonclassmethod(cls, *, x: 'int', y: 'int', diameter_nm: 'int', corner_count: 'int', orient_deg: 'float') -> 'KiCadPlotterOp'
from_dictclassmethod(cls, data: 'dict[str, Any]') -> 'KiCadPlotterOp'
pen_toclassmethod(cls, *, x: 'int', y: 'int', action: 'KiCadPenAction | str' = <KiCadPenAction.DOWN: 'D'>) -> 'KiCadPlotterOp'
plot_imageclassmethod(cls, *, x: 'int', y: 'int', width_nm: 'int', height_nm: 'int', scale: 'float' = 1.0, image_data_b64: 'str' = '', image_format: 'str' = 'png') -> 'KiCadPlotterOp'
plot_polyclassmethod(cls, *, points: 'list[tuple[int, int]] | list[list[int]]', fill: 'KiCadFillType | str' = <KiCadFillType.NO_FILL: 'NO_FILL'>, width_nm: 'int' = 0) -> 'KiCadPlotterOp'
rectclassmethod(cls, *, x1: 'int', y1: 'int', x2: 'int', y2: 'int', fill: 'KiCadFillType | str' = <KiCadFillType.NO_FILL: 'NO_FILL'>, width_nm: 'int' = 0, corner_radius_nm: 'int' = 0) -> 'KiCadPlotterOp'
set_colorclassmethod(cls, *, color: 'str') -> 'KiCadPlotterOp'
set_current_line_widthclassmethod(cls, *, width_nm: 'int') -> 'KiCadPlotterOp'
set_dashclassmethod(cls, *, line_width_nm: 'int', line_style: 'KiCadLineStyle | str') -> 'KiCadPlotterOp'
set_page_settingsclassmethod(cls, *, page_type: 'str', width_nm: 'int', height_nm: 'int', portrait: 'bool' = False) -> 'KiCadPlotterOp'
set_viewportclassmethod(cls, *, offset_x_nm: 'int', offset_y_nm: 'int', ius_per_decimil: 'float', scale: 'float', mirror: 'bool') -> 'KiCadPlotterOp'
start_blockclassmethod(cls, *, label: 'str' = '', data_uuid: 'str' = '', data_ref: 'str' = '', object_id: 'str' = '', extra_attrs: 'dict[str, Any] | None' = None, layers: 'list[str] | tuple[str, ...] | None' = None) -> 'KiCadPlotterOp'
start_plotclassmethod(cls, *, page_name: 'str' = '') -> 'KiCadPlotterOp'
textclassmethod(cls, *, x: 'int', y: 'int', text: 'str', color: 'str' = '#000000', orient_deg: 'float' = 0.0, size_x_nm: 'int', size_y_nm: 'int', h_align: 'KiCadHorizAlign | str' = <KiCadHorizAlign.LEFT: 'GR_TEXT_H_ALIGN_LEFT'>, v_align: 'KiCadVertAlign | str' = <KiCadVertAlign.BOTTOM: 'GR_TEXT_V_ALIGN_BOTTOM'>, pen_width_nm: 'int' = 0, italic: 'bool' = False, bold: 'bool' = False, multiline: 'bool' = False, font_face: 'str' = '', render_cache_polygons: 'list[list[list[int]]] | None' = None, render_cache: 'dict[str, Any] | None' = None) -> 'KiCadPlotterOp'
thick_arcclassmethod(cls, *, cx: 'float', cy: 'float', start_angle_deg: 'float', sweep_deg: 'float', radius_nm: 'float', width_nm: 'int') -> 'KiCadPlotterOp'
thick_segmentclassmethod(cls, *, start_x: 'int', start_y: 'int', end_x: 'int', end_y: 'int', width_nm: 'int') -> 'KiCadPlotterOp'
to_dictmethod(self, *, index: 'int | None' = None) -> 'dict[str, Any]'

KiCadPlotterRecord

class
from kicad_monkey import KiCadPlotterRecord
class KiCadPlotterRecord(uuid: 'str', kind: 'str', object_id: 'str', bounds: 'KiCadPlotterBounds | None' = None, operations: 'list[KiCadPlotterOp]' = <factory>, extras: 'dict[str, Any]' = <factory>) -> 'None'

One source-item-keyed sub-stream of plotter ops.

Every record corresponds to one schematic or PCB item (symbol, wire,
label, footprint, pad, track, ...) and groups all of its plotter calls
for downstream diff and scene tooling.

Members (2)
MemberKindSignatureSummary
from_dictclassmethod(cls, data: 'dict[str, Any]') -> 'KiCadPlotterRecord'
to_dictmethod(self) -> 'dict[str, Any]'

compiled_schematic_graph_page_view

function
from kicad_monkey import compiled_schematic_graph_page_view
def compiled_schematic_graph_page_view(compiled_schematic_graph: 'dict[str, Any]', schematic_instance: 'object', *, graph_artifact: 'str', artifact_key: 'str' = 'sch.dwg_scene') -> 'dict[str, Any]'

Project deterministic graph/SVG joins for one schematic occurrence.

footprint_to_ir

function
from kicad_monkey import footprint_to_ir
def footprint_to_ir(footprint: "'KiCadFootprint'", *, source_path: 'str | None' = None, document_id: 'str | None' = None) -> 'KiCadPlotterDocument'

Render a :class:`KiCadFootprint` to a :class:`KiCadPlotterDocument`.

Emits a single record (``kind="footprint"``) carrying every
geometry op for the footprint, in KiCad's canonical emit order.
A footprint has no unit/style axis, so a single record is sufficient.

KICAD_PLOTTER_IR_SCHEMA

constant
from kicad_monkey import KICAD_PLOTTER_IR_SCHEMA
KICAD_PLOTTER_IR_SCHEMA = 'kicad.plotter_ir.a0'

str(object='') -> str
str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or
errors is specified, then the object must expose a data buffer
that will be decoded using the given encoding and error handler.
Otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to 'utf-8'.
errors defaults to 'strict'.

KICAD_SCHEMATIC_COMPILED_GRAPH_VIEW_SCHEMA

constant
from kicad_monkey import KICAD_SCHEMATIC_COMPILED_GRAPH_VIEW_SCHEMA
KICAD_SCHEMATIC_COMPILED_GRAPH_VIEW_SCHEMA = 'kicad_monkey.schematic.svg.compiled_graph_view.a0'

str(object='') -> str
str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or
errors is specified, then the object must expose a data buffer
that will be decoded using the given encoding and error handler.
Otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to 'utf-8'.
errors defaults to 'strict'.

KICAD_SCHEMATIC_GRAPH_ARTIFACT_KEY

constant
from kicad_monkey import KICAD_SCHEMATIC_GRAPH_ARTIFACT_KEY
KICAD_SCHEMATIC_GRAPH_ARTIFACT_KEY = 'sch.dwg_scene'

str(object='') -> str
str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or
errors is specified, then the object must expose a data buffer
that will be decoded using the given encoding and error handler.
Otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to 'utf-8'.
errors defaults to 'strict'.

KICAD_SCHEMATIC_GRAPH_LINKAGE_CONTRACT

constant
from kicad_monkey import KICAD_SCHEMATIC_GRAPH_LINKAGE_CONTRACT
KICAD_SCHEMATIC_GRAPH_LINKAGE_CONTRACT = 'kicad_monkey.schematic.svg.compiled_graph_linkage.a0'

str(object='') -> str
str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or
errors is specified, then the object must expose a data buffer
that will be decoded using the given encoding and error handler.
Otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to 'utf-8'.
errors defaults to 'strict'.

KiCadFillType

enum
from kicad_monkey import KiCadFillType
enum KiCadFillType

Mirror of ``FILL_T`` in ``include/eda_shape.h``.

Members (7)
MemberKindSignatureSummary
NO_FILLmember= 'NO_FILL'
FILLED_SHAPEmember= 'FILLED_SHAPE'
FILLED_WITH_BG_BODYCOLORmember= 'FILLED_WITH_BG_BODYCOLOR'
FILLED_WITH_COLORmember= 'FILLED_WITH_COLOR'
HATCHmember= 'HATCH'
REVERSE_HATCHmember= 'REVERSE_HATCH'
CROSS_HATCHmember= 'CROSS_HATCH'

KiCadHorizAlign

enum
from kicad_monkey import KiCadHorizAlign
enum KiCadHorizAlign

Mirror of ``GR_TEXT_H_ALIGN_T`` in ``include/eda_text.h``.

Members (4)
MemberKindSignatureSummary
LEFTmember= 'GR_TEXT_H_ALIGN_LEFT'
CENTERmember= 'GR_TEXT_H_ALIGN_CENTER'
RIGHTmember= 'GR_TEXT_H_ALIGN_RIGHT'
INDETERMINATEmember= 'GR_TEXT_H_ALIGN_INDETERMINATE'

KiCadLineStyle

enum
from kicad_monkey import KiCadLineStyle
enum KiCadLineStyle

Mirror of ``LINE_STYLE`` in ``include/stroke_params.h``.

Members (6)
MemberKindSignatureSummary
DEFAULTmember= 'DEFAULT'
SOLIDmember= 'SOLID'
DASHmember= 'DASH'
DOTmember= 'DOT'
DASH_DOTmember= 'DASH_DOT'
DASH_DOT_DOTmember= 'DASH_DOT_DOT'

KiCadPenAction

enum
from kicad_monkey import KiCadPenAction
enum KiCadPenAction

Plume kind for :meth:`KiCadPlotterOp.pen_to` (``PenTo`` in C++).

Members (3)
MemberKindSignatureSummary
UPmember= 'U'
DOWNmember= 'D'
ZEROmember= 'Z'

KiCadPlotterOpKind

enum
from kicad_monkey import KiCadPlotterOpKind
enum KiCadPlotterOpKind

Every PLOTTER virtual method exposed in ``include/plotters/plotter.h``
has a corresponding op kind. The ``str`` values match the C++ method
name verbatim so a future ``RECORDER_PLOTTER`` patch can dump JSON
by introspecting the call site.

Members (27)
MemberKindSignatureSummary
PEN_TOmember= 'PenTo'
CIRCLEmember= 'Circle'
ARC_THREE_POINTmember= 'ArcThreePoint'
ARC_CENTER_ANGLEmember= 'ArcCenterAngle'
BEZIER_CURVEmember= 'BezierCurve'
RECTmember= 'Rect'
PLOT_POLYmember= 'PlotPoly'
TEXTmember= 'Text'
PLOT_IMAGEmember= 'PlotImage'
THICK_SEGMENTmember= 'ThickSegment'
THICK_ARCmember= 'ThickArc'
FLASH_PAD_CIRCLEmember= 'FlashPadCircle'
FLASH_PAD_OVALmember= 'FlashPadOval'
FLASH_PAD_RECTmember= 'FlashPadRect'
FLASH_PAD_ROUNDRECTmember= 'FlashPadRoundRect'
FLASH_PAD_CUSTOMmember= 'FlashPadCustom'
FLASH_PAD_TRAPEZmember= 'FlashPadTrapez'
FLASH_REG_POLYGONmember= 'FlashRegularPolygon'
SET_CURRENT_LINE_WIDTHmember= 'SetCurrentLineWidth'
SET_COLORmember= 'SetColor'
SET_DASHmember= 'SetDash'
SET_VIEWPORTmember= 'SetViewport'
START_PLOTmember= 'StartPlot'
END_PLOTmember= 'EndPlot'
SET_PAGE_SETTINGSmember= 'SetPageSettings'
START_BLOCKmember= 'StartBlock'
END_BLOCKmember= 'EndBlock'

KiCadVertAlign

enum
from kicad_monkey import KiCadVertAlign
enum KiCadVertAlign

Mirror of ``GR_TEXT_V_ALIGN_T`` in ``include/eda_text.h``.

Members (4)
MemberKindSignatureSummary
TOPmember= 'GR_TEXT_V_ALIGN_TOP'
CENTERmember= 'GR_TEXT_V_ALIGN_CENTER'
BOTTOMmember= 'GR_TEXT_V_ALIGN_BOTTOM'
INDETERMINATEmember= 'GR_TEXT_V_ALIGN_INDETERMINATE'

lib_symbol_to_ir

function
from kicad_monkey import lib_symbol_to_ir
def lib_symbol_to_ir(symbol: "'LibSymbol'", *, unit: 'int | None' = None, style: 'int' = 0, source_path: 'str | None' = None, document_id: 'str | None' = None, default_stroke_width_nm: 'int' = 152400, default_polyline_stroke_width_nm: 'int' = 152400, pin_block_factory: "Callable[['SymPin'], dict[str, Any] | None] | None" = None, project_vars: 'dict | None' = None) -> 'KiCadPlotterDocument'

Render a :class:`LibSymbol` to a :class:`KiCadPlotterDocument`.

``unit`` selects which unit's subsymbols to include (plus the
common ``unit=0`` subsymbol). When ``unit`` is ``None``, every
matching-``style`` subsymbol is included.
``style`` follows KiCad's body-style convention (0 = normal, 1 =
De Morgan).

Each kept :class:`LibSubSymbol` becomes one :class:`KiCadPlotterRecord`
with ``kind="lib_subsymbol"``; a leading record with
``kind="lib_symbol"`` carries top-level metadata so consumers can
identify the source symbol without re-walking.

normalize_schematic_svg_color_role

function
from kicad_monkey import normalize_schematic_svg_color_role
def normalize_schematic_svg_color_role(role: 'object') -> 'str'

Return the canonical schematic SVG colour role name.

pcb_to_ir

function
from kicad_monkey import pcb_to_ir
def pcb_to_ir(pcb: "'KiCadPcb'", *, source_path: 'str | None' = None, document_id: 'str | None' = None, primary_errors=None, layer_flash_resolver: 'PcbLayerFlashResolver | None' = None) -> 'KiCadPlotterDocument'

Render a :class:`KiCadPcb` to a :class:`KiCadPlotterDocument`.

``layer_flash_resolver`` lets a caller share one
``PcbLayerFlashResolver.from_board(pcb)`` across operations on a board it
does not change; by default one is built from the board's current state.

Records are emitted in a stable per-category order:

gr_lines → gr_arcs → gr_circles → gr_rects → gr_polys →
gr_curves → gr_texts → segments → track_arcs → vias →
zones → footprints

Footprint records are built by :func:`pcb_footprint_to_record`
(which reuses footprint per-element op emitters and carries the

render_ir_to_svg

function
from kicad_monkey import render_ir_to_svg
def render_ir_to_svg(doc: 'KiCadPlotterDocument', *, options: 'KiCadSvgRenderOptions | None' = None, ctx: 'KiCadSvgRenderContext | None' = None, root_extra_attrs: 'dict[str, object] | None' = None, metadata_elements: 'Iterable[str] | None' = None) -> 'str'

Render a :class:`KiCadPlotterDocument` as a complete SVG document.

Either pass a fully-prepared ``ctx`` (canvas dims already set) or
let the renderer build a default context from ``options`` and the
document's ``canvas`` field. Full-page worksheet background fills
render first, while the ``sheet_header`` border and title block
render last without changing the document's stored IR record order.

render_library_svg

function
from kicad_monkey import render_library_svg
def render_library_svg(library: "'KiCadSymbolLib'", output_dir: 'Path', theme: 'Optional[SymbolTheme]' = None, options: 'Optional[SymbolRenderOptions]' = None) -> 'int'

Render all symbols in a library to individual SVG files.

Args:
library: KiCadSymbolLib to render
output_dir: Directory to write SVG files
theme: Color theme
options: Render options

Returns:
Number of symbols rendered

render_pcb_ir_to_svg

function
from kicad_monkey import render_pcb_ir_to_svg
def render_pcb_ir_to_svg(pcb: "'KiCadPcb'", *, layers: 'Optional[Sequence[str]]' = None, fill: 'str' = '#000000', stroke: 'str' = '#000000', black_and_white: 'bool' = True, profile: 'str | None' = None, options: "'Optional[KiCadSvgRenderOptions]'" = None) -> 'str'

Render a :class:`KiCadPcb` to SVG via the plotter-IR pipeline.

The frame is kicad-cli's fit-to-board page: the board outline's extent
without its stroke when the board has a closed outline
(``pcb_svg_page_bounding_box``), else the all-layer bounding box. When
``layers`` is provided, records whose layer set does not intersect the
requested set are dropped before rendering.

render_schematic_svg

function
from kicad_monkey import render_schematic_svg
def render_schematic_svg(schematic: "'KiCadSchematic'", theme: 'SchematicTheme | None' = None, options: 'SchematicRenderOptions | None' = None, *, source_path: 'str | Path | None' = None, document_id: 'str | None' = None, sheet_index: 'int' = 1, sheet_count: 'int' = 1, sheet_path: 'str' = '/', sheet_instance_path: 'str | None' = None, sheet_name: 'str' = '', project_vars: 'dict | None' = None, render_options: 'KiCadSvgRenderOptions | None' = None) -> 'str'

Render a KiCad schematic to SVG through the plotter-IR pipeline.

render_symbol_svg

function
from kicad_monkey import render_symbol_svg
def render_symbol_svg(symbol: "'LibSymbol'", theme: 'Optional[SymbolTheme]' = None, options: 'Optional[SymbolRenderOptions]' = None) -> 'str'

Render a symbol to SVG format.

Output matches KiCad CLI's `kicad-cli sym export svg` format:
- ViewBox starts at 0,0 (all coordinates translated)
- Inline styles (no CSS classes)
- Text rendered as stroke font paths
- Colors: #840000 for body, #006464 for text

Args:
symbol: LibSymbol to render
theme: Color theme (defaults to KiCad CLI colors)
options: Render options (unit, style, margins)

Returns:

resolve_compiled_schematic_graph_page_occurrence

function
from kicad_monkey import resolve_compiled_schematic_graph_page_occurrence
def resolve_compiled_schematic_graph_page_occurrence(compiled_schematic_graph: 'dict[str, Any]', schematic_instance: 'object') -> 'dict[str, Any]'

Resolve exactly one graph page for a concrete schematic occurrence.

SCHEMATIC_SVG_BLACK_AND_WHITE_ROLE_COLORS

constant
from kicad_monkey import SCHEMATIC_SVG_BLACK_AND_WHITE_ROLE_COLORS
SCHEMATIC_SVG_BLACK_AND_WHITE_ROLE_COLORS = {'background': '#FFFFFF', 'bus': '#000000', 'bus_junction': '#000000', 'component_body': '#FFFFFF', 'component_outline':

dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)

SCHEMATIC_SVG_COLOR_ROLES

constant
from kicad_monkey import SCHEMATIC_SVG_COLOR_ROLES
SCHEMATIC_SVG_COLOR_ROLES = ('background', 'bus', 'bus_junction', 'component_body', 'component_outline', 'dnp_marker', 'fields', 'foreground', 'junc

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

schematic_svg_role_color

function
from kicad_monkey import schematic_svg_role_color
def schematic_svg_role_color(role_colors: 'Mapping[str, str] | None', role: 'str', *, default: 'str | None' = None) -> 'str | None'

Return a configured colour for one semantic schematic SVG role.

schematic_svg_role_color_overrides

function
from kicad_monkey import schematic_svg_role_color_overrides
def schematic_svg_role_color_overrides(role_colors: 'Mapping[str, str] | None', *, base: 'Mapping[str, str] | None' = None) -> 'dict[str, str]'

Return source-colour overrides for semantic schematic SVG roles.

Role names use KiCad colour-theme keys such as ``wire``,
``component_outline``, ``component_body``, ``pin``, ``pin_name``,
``label_global``, and ``worksheet``. Unknown roles raise ``ValueError`` so
misspelled review/theme configs fail early.

SCHEMATIC_SVG_ROLE_COLORS

constant
from kicad_monkey import SCHEMATIC_SVG_ROLE_COLORS
SCHEMATIC_SVG_ROLE_COLORS = {'background': '#F5F4EFFF', 'bus': '#000084FF', 'bus_junction': '#000084FF', 'component_body': '#FFFFC2FF', 'component_o

dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)

schematic_to_ir

function
from kicad_monkey import schematic_to_ir
def schematic_to_ir(schematic: "'KiCadSchematic'", *, source_path: 'Optional[str]' = None, document_id: 'Optional[str]' = None, sheet_index: 'int' = 1, sheet_count: 'int' = 1, sheet_path: 'str' = '/', sheet_instance_path: 'Optional[str]' = None, sheet_name: 'str' = '', project_vars: 'Optional[dict]' = None, diagnostics: 'Optional[list]' = None) -> 'KiCadPlotterDocument'

Convert a :class:`KiCadSchematic` to a :class:`KiCadPlotterDocument`.

An object that cannot be drawn is left out and the rest of the page is
drawn. When ``diagnostics`` is a list, an ``object_not_drawn`` error is
appended to it for each such object; diagnostics never enter the IR.

Emits one ``sheet_header`` record (paper + title block) followed
by per-element records in KiCad's natural emit order:
wires → buses → bus_entries → junctions → no_connects →
labels (local / global / hierarchical) → texts →
symbol instances → hierarchical sheets.

Coordinates are KiCad internal-unit nm; the Y axis is "down" (no
flip — schematic file coords are already screen-Y).

validate_schematic_svg_compiled_graph_view

function
from kicad_monkey import validate_schematic_svg_compiled_graph_view
def validate_schematic_svg_compiled_graph_view(svg_text: 'str', compiled_schematic_graph: 'dict[str, Any]', graph_view: 'dict[str, Any]') -> 'dict[str, int]'

Validate page ownership and exact SVG identity resolution for a view.

kicad-monkey v2026.11.30·Docs updated 2026.12.01 15:43 UTC (fd9b75b)