Skip to content

Routing options and precedence ​

The builder methods of a route, teardrops, the autoroute parameters and net classes, each with its default. Advanced. The route call and its chain are in routing.md; how the router uses these in autorouter.md.

Builder methods ​

MethodDefault
.width(mm)class width, else minTrackWidth
.current(amps)none; checked against the width, routing.md
.solver(fn)none; asked for each automatic leg first, autorouter.md
.layer(name), start layerthe pad's layer, else F.Cu
.layers([...]), layers for automatic legsautorouter.md Layers
.vias(false), .vias({ drill, size })allowed, default via
.rules({ ... }), the autoroute parameters without a methodthe board's
.priority(n)0; higher routes first
.net(net), .net(P, N), .net(null)from the pads
.root(end)route(NET) only, its first pad
.direct()off; the legs join no other copper of their net
.loop()off; the net's loop is intended, no net-loop
.impedance(ohms)none; width from the stackup for the start layer unless .width()
.gap(mm), .skew(mm)pairs only, pairs.md
.length(mm), .length({ min, max, target, tolerance })none, length.md
.match(group, tolerance?)none, length.md
.neck({ width, length })class neck, else on
.corner(r), .corner('none')class corner, else square; a pair rounds by its pitch
.teardrops(false), .teardrops({ … })class teardrops, else the board's
  • .corner(r) arcs manual corners on the centre line, shrinking to fit, then a 45 degree chamfer, else square; automatic legs keep the router's.
  • Neck-down: where the route is too wide or crowds nearby pads, the pad's smaller side or width, at least minTrackWidth, for up to length mm, default 2; { length: 0 } is off.

Teardrops ​

tsx
import PCB from '@pcbjs/core'
export default <PCB name="B" rev="0.1.0" teardrops={{ pads: 'tht', length: 0.5, width: 0.9 }} />
  • KiCad 7's straight teardrop: length past the pad edge, base width across the pad centre; a number is a fraction of the pad's smaller side, '0.6mm' a length. Bare teardrops takes the defaults; pads is 'tht', 'smd' or 'all', the default; a class teardrops: true takes the board's.
  • Net copper drawn after tuning, before pours; none on a track 0.9 of the pad side or wider. One breaking a clearance shrinks to 75%, 50%, else the info teardrop-dropped.

Autoroute parameters ​

<PCB autoroute={{ … }}>, a preset, a variant target or defineDefaultBoard, merged by key; a route overrides with its methods, and with .rules() for the rest.

ParameterDefaultMeaning
algorithm'maze''maze', 'straight' that avoids nothing, or a custom RouteFn
pitchwidth / 2, 0.05 to 0.1grid step in mm
viaCost5mm of track one via costs
layersthe ends' layers, widenedcopper the router may use, first preferred; .layers() on a route
viathe default via{ drill, size } of routed vias; .vias({ … }) on a route
clearance0.02extra mm over the rules around obstacles and the edge
bend'45''90' forbids diagonals
prefernone{ 'F.Cu': 'h', 'B.Cu': 'v' }; across costs 1.5 times
maxViasunlimitedper route; .vias(false) for none
avoidnonesoft keepouts: points kept 0.5 mm clear or { x, y, w, h, layer? }
priority0higher runs first; .priority() on a route
viaInPadfalseper route: a via may land in an SMD pad of the net
ripup12negotiation rounds, 0 off, autorouter.md
maxDetour{ ratio: 3, floor: 10 }a leg's limit: the larger of ratio times its straight line and line plus floor mm; ratio 0 off
tune{ amplitude: 1, spacing: 0.6, maxAmplitude: 3 }meander height, gap between runs, height limit, mm, length.md

Net classes ​

tsx
import PCB from '@pcbjs/core'
const { VBUS } = nets({ VBUS: { class: 'power' } })
export default <PCB name="B" rev="0.1.0" classes={{ power: { width: 0.5, clearance: 0.25 } }} />

Tag with nets({ … }) or bus(name, n, { class }); define in <PCB classes>, a preset, a variant target or defineDefaultBoard({ classes }), merged by class then field.

FieldDefaultMeaning
widthminTrackWidthroute width without .width()
clearancethe rules'to other nets, the largest of rules and both classes; { track: 0.4 } by kind, rules.md Overrides
impedancenoneohms; without width, the start layer's width to 0.01 mm, stackup-and-rules.md
viadefault via{ drill, size }
layersautorouter.mdrouter layers
autoroutenoneparameters over the board's
gapthe widthpair gap, edge to edge
skew0.1pair length difference, pair-skew
uncoupled5pair uncoupled length, pair-uncoupled
tolerance0.1for .length(mm) and .match()
neckon, 2 mm{ width, length }
cornernone, a pair its pitcha radius or 'none'
teardropsthe board'strue, an object, false
loopsfalseloops intended, no net-loop
  • Route methods beat the class, the class the board. Start layer: .layer(), else the first pad's copper, F.Cu first.
  • The router keeps the class clearance, so a class route draws no clearance finding of its own.
  • A tag missing from the table is the ERC warning net-class; with no table, tags are labels.

MIT licensed. A proof of concept, pre 0.1.