Skip to main content

Standard 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:

import lib

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

113322J112R110kGND12C1100nGND

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>

import lib

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

11332244J111332244J2

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:

import lib

v5v = supply("5V")

at v5v
wire down 100
add R1 = res(10k)
wire down 100

5V12R110k

In the above example, after wire down 20 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:

import lib

v5v = supply("5V")

at v5v
wire down 100

to R1 = res(10k) pin 1
at R1 pin 2

wire down 100

5V12R110k

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.

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:

import lib

at supply("5V")
wire down 100 right 200 down 100 right 200

5V

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