main
John Lauer
Record board-20 copper candidate and bounded sensor service-access diagnostics without claiming acceptance
badf289
import pcbnew,pathlib,shutil,subprocess
p=pathlib.Path('C:/Users/arav/Downloads/electronic-load-issue-1');src=p/'source-receiver-spread.kicad_pcb';dst=p/'source-smooth.kicad_pcb'
for ext in ['.kicad_pro','.kicad_dru']:shutil.copyfile(src.with_suffix(ext),dst.with_suffix(ext))
m=pcbnew.GetSettingsManager();pr=str(dst.with_suffix('.kicad_pro'));m.LoadProject(pr);b=pcbnew.LoadBoard(str(src));b.SetProject(m.GetProject(pr));tracks=list(b.GetTracks());removed=[]
for t in tracks:
if t.m_Uuid.AsString()=='3b6462fa-fe3c-450b-b89f-ad9d10469424':removed.append(t.m_Uuid.AsString());b.Remove(t)
assert len(removed)==1,removed
pcbnew.SaveBoard(str(dst),b);b2=pcbnew.LoadBoard(str(dst));b2.SetProject(m.GetProject(pr));pcbnew.ZONE_FILLER(b2).Fill(b2.Zones());pcbnew.SaveBoard(str(dst),b2)
r=subprocess.run(['C:/Users/arav/AppData/Local/Programs/KiCad/10.0/bin/kicad-cli.exe','pcb','drc','--format','json','--output',str(p/'source-smooth-drc.json'),str(dst)],capture_output=True,text=True);print(r.stdout,r.stderr)