Skip to main content

frame

Frames help to visually organize different subgraphs of circuits. These subgraphs are determined during execution of the circuitscript code and is used by the layout engine to group graphical circuits together.

Frames must completely encapsulate a subgraph/multiple subgraphs, otherwise the graphical output may be incorrect/unpredictable.

info

It is always a good practice to organize schematics for clarity

Example:

from "std" import *
v5v = supply("5V")
gnd = dgnd()

frame:
..title = "Pull down resistor"

at v5v
wire down 100
add res(10k)
wire down 100
to gnd

frame:
..title = "Decoupling cap"

at v5v
wire down 100
add cap(100n)
wire down 100
to gnd
line 8:55VComponent R1: line 10:5R110kline 12:8GNDline 17:55VComponent C1: line 19:5C1100nline 21:8GNDPull down resistorDecoupling cap

Frame properties

Frame properties can be set by using the double dot (..) operator followed by the property name. This operator must be used immediately after the frame command is called.

title

Specify the title to display in the frame.

from "std" import *
v5v = supply("5V")
gnd = dgnd()

frame:
..title = "Pull down resistor"

at v5v
wire down 100
add res(10k)
wire down 100
to gnd
line 8:55VComponent R1: line 10:5R110kline 12:8GNDPull down resistor

border

The frame border thickness can be set to draw thicker/thinner borders. Set the frame border to 0 to hide the border.

from "std" import *
v5v = supply("5V")
v3v3 = supply("3V3")
gnd = dgnd()

frame:
..title = "With border"
..border = 5

at v5v
wire down 100
add res(10k)
wire down 100
to gnd

frame:
..title = "With no border"
..border = 0

at v5v
wire down 100
add res(10k)
wire down 100
to gnd

frame:
..title = "With thicker border"
..border = 20

at v5v
wire down 100
add res(10k)
wire down 100
to gnd
line 10:55VComponent R1: line 12:5R110kline 14:8GNDline 20:55VComponent R2: line 22:5R210kline 24:8GNDline 30:55VComponent R3: line 32:5R310kline 34:8GNDWith borderWith no borderWith thicker border

width and height

Sets the dimensions of the frame

from "std" import *
v5v = supply("5V")
gnd = dgnd()

frame:
..width = 1500
..height = 1500

at v5v
wire down 100
add res(10k)
wire down 100
to gnd
line 9:55VComponent R1: line 11:5R110kline 13:8GND

direction

Specify how subgraphs within the frame should be arranged. There are currently two possible options: row and column. When unspecified, the frame direction is row.

Example for row direction:

from "std" import *
v5v = supply("5V")
v3v3 = supply("3V3")
gnd = dgnd()

frame:
..title = "Pull down resistors"

at v5v
wire down 100
add res(10k)
wire down 100
to gnd

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd
line 9:55VComponent R1: line 11:5R110kline 13:8GNDline 15:53V3Component R2: line 17:5R220kline 19:8GNDPull down resistors

Example for column direction:

from "std" import *
v5v = supply("5V")
v3v3 = supply("3V3")
gnd = dgnd()

frame:
..title = "Pull down resistors"
..direction = "column"

at v5v
wire down 100
add res(10k)
wire down 100
to gnd

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd
line 10:55VComponent R1: line 12:5R110kline 14:8GNDline 16:53V3Component R2: line 18:5R220kline 20:8GNDPull down resistors

align

Sets the horizontal alignment of content within the frame. Possible values are "left", "center", "right".

from "std" import *
v5v = supply("5V")
v3v3 = supply("3V3")
gnd = dgnd()

frame:
..title = "align left"
..direction = "row"
..align = "left"
..width = 1000

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd

frame:
..title = "align center"
..direction = "row"
..align = "center"
..width = 1000

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd

frame:
..title = "align right"
..direction = "row"
..align = "right"
..width = 1000

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd

line 12:53V3Component R1: line 14:5R120kline 16:8GNDline 24:53V3Component R2: line 26:5R220kline 28:8GNDline 36:53V3Component R3: line 38:5R320kline 40:8GNDalign leftalign centeralign right

valign

Sets the vertical alignment of content within the frame. Possible values are "top", "center", "bottom".

from "std" import *
v5v = supply("5V")
v3v3 = supply("3V3")
gnd = dgnd()

frame:
..title = "align top"
..direction = "row"
..valign = "top"
..width = 1000
..height = 2000

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd

frame:
..title = "align center"
..direction = "row"
..valign = "center"
..width = 1000
..height = 2000

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd

frame:
..title = "align bottom"
..direction = "row"
..valign = "bottom"
..width = 1000
..height = 2000

at v3v3
wire down 100
add res(20k)
wire down 100
to gnd

line 13:53V3Component R1: line 15:5R120kline 17:8GNDline 26:53V3Component R2: line 28:5R220kline 30:8GNDline 39:53V3Component R3: line 41:5R320kline 43:8GNDalign topalign centeralign bottom

Nested frames and arranging frames

Frames can be nested and combined to visually organize circuits better.

from "std" import *
v3v3 = supply("3V3")
gnd = dgnd()


frame:
..border = 0
..title = "LEDs"
..direction = "row"

frame:
..title = "LED 1"

at v3v3
wire down 100
add res(100)
wire down 100
add led("green") pin 2
wire down 100
to gnd

frame:
..title = "LED 2"

at v3v3
wire down 100
add res(100)
wire down 100
add led("green") pin 2
wire down 100
to gnd

frame:
..title = "LED 3"

at v3v3
wire down 100
add res(100)
wire down 100
add led("green") pin 2
wire down 100
to gnd

line 14:93V3Component R1: line 16:9R1100Component D1: line 18:912D1greenline 20:12GNDline 25:93V3Component R2: line 27:9R2100Component D2: line 29:912D2greenline 31:12GNDline 36:93V3Component R3: line 38:9R3100Component D3: line 40:912D3greenline 42:12GNDLEDsLED 1LED 2LED 3