Organizing with 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.
At the moment, 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:
import lib
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.
import lib
v5v = supply("5V")
gnd = dgnd()
frame:
..title = "Pull down resistor"
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 column
.
Example for row
direction:
import lib
v5v = supply("5V")
v3v3 = supply("3V3")
gnd = dgnd()
frame:
..title = "Pull down resistors"
..direction = "row"
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:
import lib
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
border
The frame border thickness can be set to draw thicker/thinner borders. Set the frame border to 0 to hide the border.
import lib
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
Nested frames and arranging frames
Frames can be nested and combined to visually organize circuits better.
import lib
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")
wire down 100
to gnd
frame:
..title = "LED 2"
at v3v3
wire down 100
add res(100)
wire down 100
add led("green")
wire down 100
to gnd
frame:
..title = "LED 3"
at v3v3
wire down 100
add res(100)
wire down 100
add led("green")
wire down 100
to gnd