Connections

Connections are created by calling PCB::net(). Connections are made between components in the same PCB, and the net() function takes a list of Pin objects.

method

net

Connect pins. Takes any number of Pin objects, so multiple pins join one net in a single call.

Example first

connections.ts
import { Capacitor, PCB } from '@typecad/pcb';
import { ATtiny85_20S } from './ATtiny85_20S';

let typecad = new PCB('typecad_docs');
let u1 = new ATtiny85_20S();
let c1 = new Capacitor({ value: '1uF' });

typecad.net(u1.VCC, c1.pin(1));     // power
typecad.net(u1.GND, c1.pin(2));     // ground

That connects pin 1 of the capacitor to the VCC pin of the ATtiny85 and pin 2 to GND.

named pcb.named(name).net(...pins)

ParameterTypeUnits / valuesDescription
namestring—The net name, visible in KiCAD. Some typeCAD utility functions only pay attention to named connections.

Sometimes it's useful to name the connection — it shows in KiCAD and helps when laying out the board. Unnamed connections become net#.

named.ts
typecad.net(u1.VCC, c1.pin(1));              // net#
typecad.named('power').net(u1.VCC, c1.pin(1));  // 'power'

Common patterns

Power distribution — multiple components on one rail:

power-rail.ts
typecad.named('VCC').net(
  microcontroller.VDD,
  cap1.pin(1),
  cap2.pin(1),
  connector.pin(1)
);

Signal connections — buses between ICs:

signals.ts
typecad.named('SDA').net(microcontroller.PB0, sensor.SDA);
typecad.named('SCL').net(microcontroller.PB1, sensor.SCL);
© 2026 typeCAD — code-defined electronics github