Component glyphs

Every component class drawn by autodraw() looks up a glyph by kind (an internal short name set in sycan.autodraw._describe()). If res/<kind>.svg exists it overrides the default labelled rect; the glyph’s viewBox becomes the component’s bounding box and any element tagged id="port-<port>" becomes the canonical pin position. See How autodraw works for how those overrides feed back into placement.

The table below lists every shipped glyph, the SymPy classes that map to it, and the spine / side-port layout. Click a glyph file (or open the in-browser glyph inspector, also bundled with the REPL) to inspect its raw SVG.

Kind

Glyph

Components

Ports (spine top / bot · sides)

File

nmos

NMOS glyph

NMOS_L1, NMOS_subthreshold, NMOS_3T

drain / source · gate

res/nmos.svg

nmos_4t

NMOS (body-aware) glyph

4-terminal NMOS_4T (body pin exposed)

drain / source · gate, bulk

res/nmos_4t.svg

pmos

PMOS glyph

PMOS_L1, PMOS_subthreshold, PMOS_3T

source / drain · gate

res/pmos.svg

pmos_4t

PMOS (body-aware) glyph

4-terminal PMOS_4T

source / drain · gate, bulk

res/pmos_4t.svg

npn

NPN BJT glyph

BJT with polarity="NPN"

collector / emitter · base

res/npn.svg

pnp

PNP BJT glyph

BJT with polarity="PNP"

emitter / collector · base

res/pnp.svg

triode

Triode glyph

Triode

plate / cathode · grid

res/triode.svg

diode

Diode glyph

Diode

anode / cathode

res/diode.svg

vsrc

Voltage source glyph

VoltageSource

n_plus / n_minus

res/vsrc.svg

isrc

Current source glyph

CurrentSource

n_plus / n_minus

res/isrc.svg

res

Resistor glyph

Resistor

n_plus / n_minus

res/res.svg

ind

Inductor glyph

Inductor

n_plus / n_minus

res/ind.svg

cap

Capacitor glyph

Capacitor

n_plus / n_minus

res/cap.svg

njf

N-channel JFET glyph

NJFET

drain / source · gate

res/njf.svg

pjf

P-channel JFET glyph

PJFET

source / drain · gate

res/pjf.svg

xcvs

Voltage-output controlled source glyph

VCVS, CCVS (voltage-output variants share this body)

n_plus / n_minus · nc_plus, nc_minus (or) ctrl

res/xcvs.svg

xccs

Current-output controlled source glyph

VCCS, CCCS (current-output variants share this body)

n_plus / n_minus · nc_plus, nc_minus (or) ctrl

res/xccs.svg

port

Port marker glyph

Port

n_plus / n_minus

res/port.svg

gnd

Ground glyph

GND

node (drawn as a single rail-tie pin)

res/gnd.svg

Controlled sources are split by output type: xcvs is shared by the V-output variants (E, H), xccs by the I-output variants (G, F). The merged ccsrc glyph that used to back all four classes is retired — drop a custom ccsrc.svg into your res_dir if you need the legacy single-symbol rendering.

The one remaining kind that does not ship a bundled SVG is tline (transmission line — falls back to the labelled rect, which lets the box size scale with the line’s length symbol).

Adding a custom glyph

Any kind in the list above can be replaced by dropping a new SVG into a directory and pointing autodraw() at it:

from sycan import autodraw

svg = autodraw(circuit, res_dir="my_glyphs/")

Two conventions the loader expects:

  1. Filename = kind. Save the file as <kind>.svg (e.g. my_glyphs/nmos.svg); the loader picks it up automatically.

  2. Pin markers = ``id=”port-<port>”``. Each pin terminal must carry an id of the form port-drain, port-gate, etc. Coordinates are read from whichever attribute the element exposes (cx/cy for a <circle>, x/y for a <rect>, the first point of a <polyline>, …). Ports that the glyph omits fall back to the canonical edge positions on the bounding box.

The bounding box defaults to the SVG viewBox; if absent, the geometric bbox of the drawing primitives + port markers is used and snapped to the routing grid. See sycan.svg_util.load_glyph() for the exact snap rules.

Pass res_dir=None to autodraw() to disable glyph loading entirely and fall back to labelled rects for every component.