main
John Lauer Publish board-19 copper repair candidate and require unresolved assembly reviews 8e53907
import pcbnew,pathlib,shutil,subprocess
p=pathlib.Path('C:/Users/arav/Downloads/electronic-load-issue-1');src=p/'board-18.kicad_pcb';dst=p/'source-pad-parallel-feed.kicad_pcb'
for ext in ['.kicad_pro','.kicad_dru']:shutil.copyfile((p/'source-pad-rounded-wide.kicad_pcb').with_suffix(ext),dst.with_suffix(ext))
m=pcbnew.GetSettingsManager();m.LoadProject(str(dst.with_suffix('.kicad_pro')));b=pcbnew.LoadBoard(str(src));b.SetProject(m.GetProject(str(dst.with_suffix('.kicad_pro'))));net=b.FindNet('SHUNT_P').GetNetCode()
for a,z,w in [((124.92,82),(124.92,83.8),1.2),((124.92,83.8),(124.3,83.8),.6)]:
 t=pcbnew.PCB_TRACK(b);t.SetStart(pcbnew.VECTOR2I(int(a[0]*1e6),int(a[1]*1e6)));t.SetEnd(pcbnew.VECTOR2I(int(z[0]*1e6),int(z[1]*1e6)));t.SetWidth(int(w*1e6));t.SetLayer(pcbnew.F_Cu);t.SetNetCode(net);b.Add(t)
for x in [124.3,124.92]:
 v=pcbnew.PCB_VIA(b);v.SetPosition(pcbnew.VECTOR2I(int(x*1e6),83800000));v.SetWidth(600000);v.SetDrill(300000);v.SetLayerPair(pcbnew.F_Cu,pcbnew.B_Cu);v.SetNetCode(net);b.Add(v)
pcbnew.ZONE_FILLER(b).Fill(b.Zones());pcbnew.SaveBoard(str(dst),b)
r=subprocess.run(['C:/Users/arav/AppData/Local/Programs/KiCad/10.0/bin/kicad-cli.exe','pcb','drc','--format','json','--output',str(p/'source-pad-parallel-feed-drc.json'),str(dst)],capture_output=True,text=True);print(r.stdout,r.stderr)