from pathlib import Path
import wx
_app=wx.App(False)
import pcbnew as k
p=Path(__file__).resolve().parent;b=k.LoadBoard(str(p/'board/led_driver.kicad_pcb'))
changed=removed=0
for t in list(b.GetTracks()):
 if not isinstance(t,k.PCB_VIA):
  if t.GetLength()<k.FromMM(.001):b.Remove(t);removed+=1
  elif t.GetWidth()<k.FromMM(.2):t.SetWidth(k.FromMM(.2));changed+=1
k.SaveBoard(str(p/'board/led_driver.kicad_pcb'),b)
assert k.ExportSpecctraDSN(b,str(p/'routing_pass2.dsn'))
print('Widened narrow tracks, removed sub1um segments:',changed,removed)
