altium monkey v2026.11.26 · gobblerito
On This Page (7)

Schematic Paint IR

Schematic Paint IR A0 (SchPaintIR) is the unified drawing pipeline behind all schematic rendering in altium-monkey: .SchDoc sheets, .SchLib symbols, compiled physical pages, and individual record previews.

Use it when you need to:

  1. render schematics or library symbols to SVG (to_svg, symbol_to_svg, to_physical_svg)
  2. render schematics or symbols directly to PNG (to_paint_png, symbol_to_paint_png, SchPaintPngRenderer)
  3. export a strict, schema-validated analytic display list (to_paint_ir, symbol_to_paint_ir, to_physical_paint_ir) for custom viewers or downstream tools
  4. control editor adornments (grid, hotspots, automatic junction colors and layering) independently of document mutation

Mental Model

Rendering happens in two steps:

  1. Produce a SchPaintIR scene: resolves parameters, font metrics, paint order, clips, transforms, and normalized PNG image resources in source mil coordinates. Controlled by SchPaintView.
  2. Lower to an output:
    • SVG (SchPaintSvgRenderer / .to_svg(options=SchPaintSvgOptions(...)))
    • PNG (SchPaintPngRenderer / .to_paint_png(png_options=SchPaintPngOptions(...)))
    • JSON (scene.write_json(...) / scene.to_json_text(), conforming to altium_monkey.sch_paint_ir.a0)

Semantic connectivity (nets, pins, components, hierarchy) stays in AltiumDesign.to_json() and Netlist.to_json() rather than being encoded into drawing commands.

Quick Start

python
from altium_monkey import (
    AltiumSchDoc,
    AltiumSchLib,
    SchJunctionColors,
    SchPaintPngOptions,
    SchPaintSvgOptions,
    SchPaintView,
)

# 1. Schematic SVG (text elements vs. portable outlined paths)
schdoc = AltiumSchDoc("sheet.SchDoc")
svg = schdoc.to_svg(options=SchPaintSvgOptions())
portable_svg = schdoc.to_svg(options=SchPaintSvgOptions(text_mode="paths"))

# 2. Editor view with custom automatic junction colors
editor_view = SchPaintView.editor(
    junction_colors=SchJunctionColors(wire_bgr=0, bus_bgr=0x800000),
    auto_junctions_on_top=True,
)
editor_svg = schdoc.to_svg(
    view=editor_view,
    options=SchPaintSvgOptions(
        include_editor_grid=True,
        include_editor_hotspots=True,
    ),
)

# 3. Export Paint IR A0 JSON or raster PNG (set dpi= or width_px=/height_px=)
scene = schdoc.to_paint_ir(view=SchPaintView.static_scene())
scene.write_json("sheet.paint-ir.json")
png_bytes = schdoc.to_paint_png(png_options=SchPaintPngOptions(dpi=192.0))

# 4. Library symbol rendering
schlib = AltiumSchLib("parts.SchLib")
symbol_svg = schlib.symbol_to_svg("R_0603", part_id=1, display_mode=0)

Presentation Views (SchPaintView)

FactoryGrid & hotspotsIntended use
SchPaintView.static_scene(...)Off (default)Clean documentation/review drawings
SchPaintView.editor(...)OnAltium editor-style previews and inspections

Both presets accept:

SVG Options (SchPaintSvgOptions)

Key options on SchPaintSvgOptions:

Single-Record & Physical-Page Rendering

Migrating From Legacy GOTIR

The legacy schematic Geometry Operation Tree IR (GOTIR) producer, renderer, and context options have been removed with no compatibility aliases:

Removed surfaceCurrent Paint IR A0 surface
AltiumSchDoc.to_ir()AltiumSchDoc.to_paint_ir()
AltiumSchLib.symbol_to_ir(...)AltiumSchLib.symbol_to_paint_ir(...)
AltiumDesign.to_physical_ir(page_ref)AltiumDesign.to_physical_paint_ir(page_ref)
Record to_geometry(...)Record to_paint_ir(SchPaintContext)
Doc/Lib/record to_paint_svg, Lib symbol_to_paint_svgCanonical to_svg / symbol_to_svg
Design to_physical_paint_svgto_physical_svg
SchSvgRenderOptions and legacy contexts/profilesSchPaintSvgOptions and SchPaintContext
altium-monkey v2026.11.26 · gobblerito·Docs updated 2026.11.29 17:55 UTC (0665053)