symbol module#
Schematic Symbols#
This module provides classes for defining schematic symbols, pins, and symbol mappings for components. You attach a symbol to a component by assigning it to a member field. The name of the field is not important, and multiple symbols can be attached to the same component to provide multiple symbol units.
- class Symbol[source]#
Bases:
StructuralSymbols are a structural element in JITX encoding the schematic representation of a part. Symbols often contain electrical connection points represented by
Pin, geometric artwork, andTextannotations. Symbols are linked to a design through aComponentwhere a symbol’sPinobjects are mapped toPortobjects.- Valid elements in a symbol are:
If a symbol is defined inside another symbol, they will be treated together as one symbol in the design.
For a rectangular symbol with automatic or configurable pin layout, use
BoxSymbol.>>> class MySymbol(Symbol): ... a = Pin(at=(1, 0), length=1, direction=Direction.Right) ... b = Pin(at=(-1, 0), length=1, direction=Direction.Left) ... pin_name_size = 0.3 ... pad_name_size = 0.3 ... orientation = SymbolOrientation(0) ... rect = rectangle(2, 2)
>>> class MyComponent(Component): ... ports = [Port() for _ in range(2)] ... symbol = BoxSymbol()
Note
Grid units are abstract schematic units where 1 grid unit equals the standard pin spacing in the schematic editor.
- class Direction(*values)[source]#
Bases:
EnumPin direction on schematic symbols.
- Left = 'left'#
- Right = 'right'#
- Up = 'up'#
- Down = 'down'#
- class Pin(at, length=0, direction=Direction.Left, pin_name_size=None, pad_name_size=None)[source]#
Bases:
StructuralSchematic symbol pin definition.
- Parameters:
- pin_name_size: float | None = None#
Font size of the pin’s pin name text in grid units, overriding the parent
Symbol’spin_name_sizeattribute.
- pad_name_size: float | None = None#
Font size of the pin’s pad name text in grid units, overriding the parent
Symbol’spad_name_sizeattribute.
- classmethod left(at, length=0, pin_name_size=None, pad_name_size=None)[source]#
Create a left-facing pin (wire extends to the left).
- Parameters:
- Returns:
A Pin instance configured to face left.
>>> Pin.left((0, 0), length=2) # Pin at row 0, col 0
- classmethod right(at, length=0, pin_name_size=None, pad_name_size=None)[source]#
Create a right-facing pin (wire extends to the right).
- Parameters:
- Returns:
A Pin instance configured to face right.
>>> Pin.right((0, 5), length=2) # Pin at row 0, col 5
- classmethod up(at, length=0, pin_name_size=None, pad_name_size=None)[source]#
Create an up-facing pin (wire extends upward).
- Parameters:
- Returns:
A Pin instance configured to face up.
>>> Pin.up((5, 2), length=1) # Pin at row 5, col 2
- class SymbolMapping(entries)[source]#
Bases:
Structural,RefMapping between component ports and schematic symbol pins.
If no symbol mapping is provided, a default mapping will be created that maps ports to symbol pins in declaration order.
>>> class MyComponent(Component): ... GND = Power() ... VIN = Power() ... VOUT = Power() ... ... symbol = MySymbol() ... mappings = SymbolMapping({ ... GND: symbol.gnd, ... VIN: symbol.vin, ... VOUT: symbol.vout, ... })