<autoroutingphase />
The <autoroutingphase /> element lets you split PCB autorouting into ordered
passes. Use it when some traces should route before others, when a net should be
routed in a dedicated pass, or when you want to reroute selected traces after
an earlier route is complete.
Reroute a Region
Add a normal phase first, assign traces or nets to that phase with
routingPhaseIndex, then add a later phase with reroute and a rectangular
region. The reroute phase uses the routes from previous phases, extracts the
connections that cross the region, and replaces the route inside that rectangle.
Without Reroute
This board uses the default autorouter for phase 0.
export default () => (
<board width="18mm" height="12mm">
<testpoint name="T1" pcbX={-7} pcbY={3} padDiameter="0.8mm" />
<testpoint name="T2" pcbX={7} pcbY={3} padDiameter="0.8mm" />
<testpoint name="M1" pcbX={-7} pcbY={0} padDiameter="0.8mm" />
<testpoint name="M2" pcbX={7} pcbY={0} padDiameter="0.8mm" />
<testpoint name="B1" pcbX={-7} pcbY={-3} padDiameter="0.8mm" />
<testpoint name="B2" pcbX={7} pcbY={-3} padDiameter="0.8mm" />
<trace from="T1.pin1" to="T2.pin1" />
<trace from="M1.pin1" to="M2.pin1" />
<trace from="B1.pin1" to="B2.pin1" />
</board>
)
With Reroute
Adding the second phase reroutes only the selected rectangle. The second phase uses a custom autorouter that returns a squiggly line, so the changed route segment is easy to see.
import { createSquigglyAutorouter } from "./demo-autorouter"
export default () => (
<board width="18mm" height="12mm">
<testpoint name="T1" pcbX={-7} pcbY={3} padDiameter="0.8mm" />
<testpoint name="T2" pcbX={7} pcbY={3} padDiameter="0.8mm" />
<testpoint name="M1" pcbX={-7} pcbY={0} padDiameter="0.8mm" />
<testpoint name="M2" pcbX={7} pcbY={0} padDiameter="0.8mm" />
<testpoint name="B1" pcbX={-7} pcbY={-3} padDiameter="0.8mm" />
<testpoint name="B2" pcbX={7} pcbY={-3} padDiameter="0.8mm" />
<autoroutingphase
reroute
region={{
shape: "rect",
minX: 0,
maxX: 8,
minY: -1,
maxY: 1,
}}
autorouter={{
algorithmFn: createSquigglyAutorouter,
}}
/>
<trace from="T1.pin1" to="T2.pin1" />
<trace from="M1.pin1" to="M2.pin1" />
<trace from="B1.pin1" to="B2.pin1" />
</board>
)
In this example, the default routing pass routes the three traces across the
board. The reroute phase does not need traces assigned to it because reroute
creates a reroute pass from the previous output. Only routes crossing the
rectangle from x=0 to x=8 and y=-1 to y=1 are reconsidered.
Assign Connections to Phases
Use connection to route a trace in a specific phase by naming one endpoint of
the trace:
<autoroutingphase phaseIndex={0} connection="U1.pin1" />
<autoroutingphase phaseIndex={1} connection="U2.pin1" />
<trace from=".U1 > .pin1" to=".J1 > .pin1" />
<trace from=".U2 > .pin1" to=".J1 > .pin2" />
Use connections when a phase should target more than one trace:
<autoroutingphase
phaseIndex={0}
connections={["U1.pin1", "U2.pin1"]}
/>
Connection selectors match trace endpoint selectors. For example,
"U1.pin1" matches a trace endpoint written as ".U1 > .pin1".
Assign Traces and Nets to Phases
Use routingPhaseIndex on a <trace /> to put that trace into a phase:
<autoroutingphase phaseIndex={0} />
<trace from="U1.pin1" to="U2.pin1" routingPhaseIndex={0} />
You can also assign a <net /> to a phase. Traces connected to that net inherit
the net's routing phase unless the trace sets its own routingPhaseIndex.
<autoroutingphase phaseIndex={0} />
<net name="GND" routingPhaseIndex={0} />
<trace from="C1.pin1" to="net.GND" />
Phases run in ascending phaseIndex order. Traces and nets without a
routingPhaseIndex run after numbered phases.
Reroute Connections
Add reroute with connection or connections to replace only those routed
connections in a later phase. Existing routes that are not selected remain in
place and are treated as obstacles by the reroute pass.
<autoroutingphase phaseIndex={0} />
<autoroutingphase phaseIndex={1} reroute connection="U1.pin1" />
<trace from=".U1 > .pin1" to=".J1 > .pin1" routingPhaseIndex={0} />
<trace from=".U2 > .pin1" to=".J1 > .pin2" routingPhaseIndex={0} />
Use region rerouting when the target is a physical area of the board. Use connection rerouting when the target is one or more specific traces.
Props
| Prop | Type | Description |
|---|---|---|
phaseIndex | number | The routing pass configured by this element. Matches routingPhaseIndex on traces and nets. |
autorouter | string | AutorouterConfig | Optional autorouter preset or configuration for this phase. Omit it to use the parent board or subcircuit autorouter. |
reroute | boolean | Makes this phase reroute traces produced by earlier phases instead of routing newly assigned traces. |
region | { shape: "rect"; minX: number; maxX: number; minY: number; maxY: number } | Rectangular PCB region to reroute. Use with reroute for area-based rerouting. |
connection | string | Endpoint selector for a trace assigned to this phase, such as "U1.pin1". Can be combined with reroute to reroute that connection. |
connections | string[] | Endpoint selectors for multiple traces assigned to this phase. Can be combined with reroute to reroute those connections. |
For custom phase autorouters with algorithmFn, see
Create or Use a Custom Autorouter.