DRAW-40 Power or tie wiring much longer than it needs, with a cheaper drawing at hand¶
| Severity | Status | Implementation |
|---|---|---|
| suggestion | runs in better_erc | hard, depends on NET-26 |
Data it needs: drawing geometry.
Looks at. The schematic drawing (geometry).
Rule: routing is a weighed compromise.
What it catches. A tie (the wires of one power net, or of a few pins tied together, between its pins and its power symbols) whose drawn length is more than drawing.route.detour_max times its Manhattan length (the half-perimeter of the box around its pins and symbols), where a cheaper drawing exists by the routing cost.
How to check. Score the drawn tie with the drawing.route.* weights (length in grid steps, bends, crossings with other nets, crossings within one grid step of a pin end or junction, extra symbols, detour ratio). Score the candidates: each pin group dropped straight along its pin axis to a symbol of its own, and the pin groups joined by the shortest L-shaped path to the existing symbol, counting the crossings each would make with the wires already drawn. Power and ground ties weigh their bends and detours drawing.route.k_power / k_ground times; ties are read where a power symbol ends them, or among pins of one part tied without a label; PWR_FLAG stubs are not part of the tie. Candidates are drawn the way the guide asks: each starts with the pin lead (drawing.pin_lead, its bend counted) and enters the symbol along its axis with a lead; a straight drop ends level with the tie's own symbol, so it stays on the section's power or ground row; a candidate touching another net's wire is dropped. The drawn tie and every candidate count their bends the same way: a corner where exactly two wires meet is a bend, and a point where three meet is a junction. Report the drawn tie and the cheapest candidate in words: the drawn tie's bends and wire length, then what to move where and the bends and length that gives ("wire of GND at x 86.36 y 72.39 has 1 bend and 31.75 mm of wire; moving GND to x 88.9 y 92.71, straight below U1.5,6,7, takes 1 bend and 27.94 mm"). A suggestion only: the candidates ignore parts that would have to move.
A power or ground symbol that shares a row or a column with another power symbol near it is lined up, as DRAW-36 compares them: within drawing.align.window, or tied to the same side of a part, and never farther apart than drawing.align.reach. Wire that only brings a symbol onto that line is no detour, so a lined-up symbol stays where it is and only the wires to it are drawn again. For example, U401's GND pins run down to a GND on the row of C404's GND: no straight drop moves that symbol.
A power or ground stub, one pin wired to one symbol, may bend once right where the wire into its symbol starts. That bend often lifts the symbol clear of a pin name or a field, so it is not counted. For example, a wire that leaves U905.2 to the right and turns up into the +VIO symbol has no counted bend and is no finding. A shared rail wire (several parts joined on one power wire with one symbol, as on a clamp or LDO rail) is weighed against a straight drop per part like any other tie: both drawings are fine, the cheaper wins (Roman, 31 Oct 2026).
Settings¶
Set them in the project file under [checks."DRAW-40"], or for one run with --set DRAW-40.NAME=VALUE. A name that starts with drawing. is shared by several checks and is set under that name alone.
| Setting | Default | Meaning |
|---|---|---|
drawing.route.w_len |
1 | cost per step of wire |
drawing.route.w_bend |
2 | cost per bend |
drawing.route.w_cross |
4 | cost per crossing with another net |
drawing.route.w_cross_near |
8 | cost of a crossing within one step of a pin end or a junction |
drawing.route.w_symbol |
6 | cost per power or ground symbol beyond the first of that rail |
drawing.route.w_detour |
4 | cost per unit of drawn length over Manhattan length, less one |
drawing.route.detour_max |
1.5 | drawn length over Manhattan length above which a cheaper drawing is looked for |
drawing.route.k_power |
2 | bends and detours of a power tie count this many times, and a bent one is looked at whatever its detour |
drawing.route.k_ground |
2 | bends and detours of a ground tie count this many times, and a bent one is looked at whatever its detour |
drawing.route.k_signal |
1 | bends and detours of a signal tie count this many times |
drawing.route.min_saving |
2 | cost a redraw must save to be worth a finding |
drawing.route.step |
2.54 mm | the grid step wire is counted in |
drawing.clearance.part |
1.27 mm | margin around a symbol's body and its pins |
drawing.clearance.power |
1.27 mm | margin around a power or ground symbol and its name |
drawing.clearance.text |
0.635 mm | margin around a field, a label, a pin name or number, a note box |
drawing.align.window |
20.32 mm | neighbourhood within which items must align exactly |
drawing.align.snap |
5.08 mm | offsets below this (and above zero) are near misses |
drawing.align.reach |
0.5 | farthest apart two items may be and still be compared, as a share of the page's longer side |
Test schematics¶
Each schematic below is in test_schematics/sources. The block under it is what berc check --only DRAW-40 reports on it.
draw-40_power_sideways¶
suggestion DRAW-40 #ymm wire of +5V at x 50.8 y 45.72 has 2 bends and 22.86 mm of wire; moving +5V to x 50.8 y 38.1, straight above R1.1, takes 0 bends and 7.62 mm
sheet /, item wire of +5V (R1.1)
fix: redraw the tie the cheaper way
draw-40_sideways_symbol¶
suggestion DRAW-40 #a65 wire of GND at x 86.36 y 72.39 has 2 bends and 36.83 mm of wire; moving GND to x 88.9 y 92.71, straight below U1.5,6,7, takes 1 bend and 27.94 mm
sheet /, item wire of GND (U1.5,6,7)
fix: redraw the tie the cheaper way
draw-40_stub_column¶
suggestion DRAW-40 #0z9 wire of GND at x 86.36 y 72.39 has 1 bend and 31.75 mm of wire; moving GND to x 88.9 y 92.71, straight below U1.5,6,7, takes 1 bend and 27.94 mm
sheet /, item wire of GND (U1.5,6,7)
fix: redraw the tie the cheaper way
draw-40_tie_detour¶
suggestion DRAW-40 #7x5 wire of GND at x 86.36 y 72.39 has 3 bends and 80.01 mm of wire; moving GND to x 88.9 y 80.01, straight below U1.5,6,7, takes 1 bend and 15.24 mm
sheet /, item wire of GND (U1.5,6,7)
fix: redraw the tie the cheaper way
DRAW-40 also fires on the test schematics of other checks: draw-30_symbols_per_pin_group, draw-41_pin_lead.