Sheets
The sheet keyword can be used to group circuits into different sheets based on standard paper sizes.
At the start of the script, specify the type of sheet with the following code: document.sheet_type = <sheet_type_function>().
The standard library supports the following sheet_type_functions: sheet_A1(), sheet_A2().. until sheet_A6()
Example:
from "std" import *
# Set default sheet type to A6
document.sheet_type = sheet_A6()
vcc = supply("VCC")
gnd = dgnd()
# Sheet created with sheet A6 graphic
sheet:
..title = "Pull down resistor"
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
# Another sheet with sheet A6 graphic
sheet:
..title = "Decoupling capacitor"
at vcc
wire down 100
add cap(100n)
wire down 100
to gnd
Sheet properties
Supports the title and direction property, similar to the frame command.
Additionally, the revision property is also available. This appears in the sheet title block and can be used to indicate the version of the schematic design.
The name property sets the file name used for the sheet when exporting a multi-sheet design to KiCad (for example ..name = "mcu_core" writes mcu_core.kicad_sch). Without it, the file name is derived from the title. See KiCad schematic format.
Sheets also accept the place_default property to mark every component on the sheet as not placed.
from "std" import *
# Set default sheet type to A6
document.sheet_type = sheet_A6()
vcc = supply("VCC")
gnd = dgnd()
# Sheet created with sheet A6 graphic
sheet:
..title = "My schematic"
..direction = "column"
..revision = "V1.2"
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
Sheet header syntax
A sheet title and direction can be written on the sheet line: sheet ["title"] [row|column]:. This follows the same rules as the frame header syntax, except that the layout modifier is not accepted for sheets and results in the error "Sheet does not accept modifier 'layout'".
from "std" import *
document.sheet_type = sheet_A6()
vcc = supply("VCC")
gnd = dgnd()
sheet "Resistors" column:
at vcc
wire down 100
add res(10k)
wire down 100
to gnd
at vcc
wire down 100
add res(1k)
wire down 100
to gnd
A blank sheet (one with no components placed in it) is no longer reported as an "Empty sheet" error.
Sheet layout
Circuits placed within a sheet will try to stay within the sheet area and will avoid being placed over the title block.
from "std" import *
# Set default sheet type to A6
document.sheet_type = sheet_A6()
vcc = supply("VCC")
gnd = dgnd()
def led_circuit():
at vcc
wire right 200
add led("green") pin 2
wire right 100
add res(1k)
wire right 100
to gnd
# Sheet created with sheet A6 graphic
sheet:
..title = "Lots of LEDs"
..revision = "V1.2"
for i in range(0, 16):
led_circuit()