# Thermal vias (tools/thermal_vias.py) The [Placer](placer.md) and the [Router](router.md) refuse footprints with bottom-side pads ("U1 has a bottom-side pad; flipped footprints are not supported"). KiCad's `_ThermalVias` footprint variants carry a B.Cu copy of the exposed pad, so they are refused too. Instead: 1. Use the plain exposed-pad footprint in the schematic. 2. Keep B.Cu free under the pad with a cost zone in `route.toml`, e.g. `{ layer = "B", fp = "U3", rect = [-2.5, -2.5, 2.5, 2.5], cost = 100 }`. Zone rects do not turn with the part, so use a square that both orientations share. 3. After routing (`tools/pnr.sh install`), add the vias: ``` sh . tools/kicad_env.sh $KPY tools/thermal_vias.py board.kicad_pcb U2 U3 U4 [--pitch 1.2 --via 0.6 --drill 0.3] ``` The script: - takes each footprint's largest SMD pad and lays a centred grid of vias on it (1.2 mm pitch, inset by radius + 0.1 mm); - gives each via the pad's net; - skips positions within clearance (0.2 mm) of another net's B.Cu copper, or closer than 0.25 mm hole to hole; - refills the zones, saves and restores the `.kicad_pro`. Run DRC afterwards. - **Plane net only.** Use it only for pads on the ground plane's net; an exposed pad on another net would cut islands into the B.Cu pour. - **Via-in-pad.** Vias inside the mask opening are open via-in-pad and can wick solder; vias under the mask are tented. At 0.3 mm drill that is fine for typical assembly; ask the fab for plugged vias if voiding matters. - **Re-run** after every `pnr.sh install`, which replaces the board.