Auto Router
typeCAD includes an auto router that generates tracks between connected pins.
Usage
Call route() on the PCB instance with a net definition:
import { PCB } from '@typecad/typecad';
import { Resistor } from '@typecad/passives/0805';
let typecad = new PCB('autoroute_example');
let r1 = new Resistor({ value: '1kohm', reference: 'R1' });
let r2 = new Resistor({ value: '1kohm', reference: 'R2' });
r1.pcb = { x: 10, y: 10, rotation: 0 };
r2.pcb = { x: 20, y: 10, rotation: 0 };
const signal_net = typecad.named('signal').net(r1.pin(1), r2.pin(1));
typecad.route(signal_net);
typecad.create(r1, r2);You can also route directly between pins without a named net:
let tracks = await typecad.route({
from: r1.pin(1),
to: r2.pin(1),
});
typecad.create(r1, r2, ...tracks);Configuration
The route method accepts an optional configuration object:
typecad.route(signal_net, {
gridResolution: 0.15,
debug: false,
});By default, the router uses a resolution derived from the trace width and clearance settings. Decreasing the resolution value increases the search space and memory usage but may help find paths in congested layouts.
On This Page