Frames
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.
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
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
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
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
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
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
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
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
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