Commands
These commands describe the connectivity between component pins.
at <component>
Places the component on the canvas and sets the current insertion point at the component. By default, if no pin number is specified, pin 1 is used.
To specify the insertion point at a given pin number, write at <component> pin <pin number>.
Example:
from "std" import *
gnd = dgnd() # define a GND net component
# create a component with 3 pins
my_component = create component:
pins: 3
at my_component # If pin is not specified, pin 1 is used.
wire left 200 down 100
add res(10k)
wire down 100
to gnd
at my_component pin 2 # Move cursor to pin 2 of component
wire right 100 down 100
add cap(100n)
wire down 100
to gnd
If there is no net at this pin, a unique net will be created.
To display a component on the schematic, it must be called at least once with at <component> or with to <component>. Otherwise, the component will not be visible in the schematic.
Example:
from "std" import *
supply1 = supply("1.1V")
supply2 = supply("2.2V")
at supply1 # visible
# supply2 is not visible
Example 2:
from "std" import *
supply1 = supply("1.1V")
supply2 = supply("2.2V")
at supply1 # visible
at supply2 # supply2 is visible
point reference
at can also position the cursor at a named point defined by point "name":
at "point_name"— move cursor to the named point defined bypoint "point_name"at some_var— move cursor to the named point stored in a variable (bare variable form, wheresome_varholds a point name string)at array_get(names, i)— move cursor to a dynamically-selected named point from an array
Example:
from "std" import *
gnd = dgnd()
names = []
gnds = []
at v5 = supply("5V")
wire down 100
for i in range(0, 5):
point "hello_" + i
array_push(names, "hello_" + i)
if i < 4:
wire right 300
for i in range(0, 5):
# dynamic reference via array_get
at array_get(names, i)
wire down 100
add cap(100n)
tmp_name = "gnd_" + i
# bare variable form
point tmp_name
array_push(gnds, tmp_name)
for i in range(0, 5):
at gnd
wire up 100
# bare variable referencing
to array_get(gnds, i)
to <component>
Places the component on the canvas and joins the current insertion point. By default, if no pin number is used, pin 1 is used.
To specify the insertion point at a given pin number, write to <component> pin <pin number>
from "std" import *
v5v = supply("5V")
gnd = dgnd()
component_1 = create component:
pins: 4
component_2 = create component:
pins: 4
at component_1 pin 2
wire right 100
to component_2 pin 1
at component_1 pin 4
wire right 100
to component_2 pin 3
point reference
to can also draw a wire to a named point defined by point "name":
to "point_name"— end the current wire at the named point defined bypoint "point_name"
Example:
from "std" import *
v3v3 = supply("3.3V")
gnd = dgnd()
some_component = create component:
pins: 3
at v3v3
wire down 100
point "tmp1"
wire down 100
add cap(100n)
wire down 100
to gnd
at some_component pin 1
wire right 100
to "tmp1"
add <component>
This adds the given component to the current insertion point (component, pin) and moves the insertion point to the next component pin of the added component.
Example:
from "std" import *
v5v = supply("5V")
at v5v
wire down 100
add R1 = res(10k)
wire down 100
In the above example, after wire down 100 is executed, the insertion point is at the end of the wire. The add command creates a new res component with value of 10k and connects the wire to pin 1 of res. The insertion point is then moved to the next available pin, in this case, it is pin 2 of the newly created res.
The above example is equivalent to:
from "std" import *
v5v = supply("5V")
at v5v
wire down 100
to R1 = res(10k) pin 1
at R1 pin 2
wire down 100
In this case, the res(10k) component needs to be assigned to a variable since it has to be referenced later after the to command.
add <component> pin <pin>
A different pin can also be specified when the component is added. The next insertion point will be the next value.
Example:
from "std" import *
my_component = create component:
pins: 4
v3v3 = supply("3.3V")
gnd = dgnd()
at v3v3
wire down 100 right 100
add my_component pin 3
wire right 100 down 100
to gnd
If the pin specified is the last pin, the next pin will be very first pin.
Example:
from "std" import *
my_component = create component:
pins: 4
v3v3 = supply("3.3V")
gnd = dgnd()
at v3v3
wire down 100 right 100
add my_component pin 4 # last pin of component
wire right 100 to gnd # insertion point continues at the first pin
wire <direction> <length>
This commands create a wire starting from the current insertion point. More segments can be added to the wire by including more direction and length values, example:
from "std" import *
at supply("5V")
wire down 100 right 200 down 100 right 200
The example above creates a wire that:
- goes down by 100 units
- goes right by 200 units
- goes down by 100 units
- goes right by 200 units