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.
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:
Filename = kind. Save the file as
<kind>.svg(e.g.my_glyphs/nmos.svg); the loader picks it up automatically.Pin markers = ``id=”port-<port>”``. Each pin terminal must carry an
idof the formport-drain,port-gate, etc. Coordinates are read from whichever attribute the element exposes (cx/cyfor a<circle>,x/yfor 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.