et.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python
  2. # Expose track for pcbnew
  3. import collections
  4. from collections import defaultdict, Counter
  5. from itertools import compress,izip, cycle
  6. import itertools
  7. import pcbnew
  8. import time
  9. import os, sys
  10. import math
  11. import re
  12. from textwrap import wrap
  13. import wx
  14. def AddMask():
  15. #Copy track to mask layer
  16. pcb = pcbnew.GetBoard()
  17. count = 0
  18. for track in pcb.GetTracks():
  19. #Set mask layer
  20. if type(track) == pcbnew.TRACK:
  21. if track.GetLayer() == pcbnew.F_Cu:
  22. maskLayer = pcbnew.F_Mask
  23. else:
  24. # if(track.GetLayer() == pcbnew.B_Cu):
  25. # maskLayer = pcbnew.B_Mask
  26. # else:
  27. continue
  28. trackMask = pcbnew.DRAWSEGMENT(pcb)
  29. trackMask.SetStart(track.GetStart())
  30. trackMask.SetEnd(track.GetEnd())
  31. trackMask.SetWidth(track.GetWidth())
  32. trackMask.SetLayer(maskLayer)
  33. pcb.Add(trackMask)
  34. count = count + 1
  35. print('{0} track masks added'.format(count))