main
John Lauer
Reconcile thermal copper specification, recheck routing, and record native copper review
02684bf
"""Native disposable candidate: apply the exact AIFlow thermal plan and refill."""
import pcbnew as k,json,shutil
from pathlib import Path
p=Path(__file__).parent
b=k.LoadBoard(str(p/'source.kicad_pcb'))
plan=json.loads((p/'plan.json').read_text())
for entry in plan['nets']:
for path in entry['paths']:
x,y=path[0]
v=k.PCB_VIA(b);v.SetPosition(k.VECTOR2I(k.FromMM(x),k.FromMM(y)));v.SetWidth(k.FromMM(entry['viaSize']));v.SetDrill(k.FromMM(entry['viaDrill']));v.SetLayerPair(k.F_Cu,k.B_Cu);v.SetNetCode(b.FindNet(entry['net']).GetNetCode());b.Add(v)
k.ZONE_FILLER(b).Fill(b.Zones());k.SaveBoard(str(p/'candidate.kicad_pcb'),b)
for ext in ['kicad_pro','kicad_dru']:shutil.copy2(p/('source.'+ext),p/('candidate.'+ext))
print('Candidate saved; exit before native CLI DRC.')