et.py 867 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python
  2. # Expose track for pcbnew
  3. import pcbnew
  4. def AddMask():
  5. #Copy track to mask layer
  6. pcb = pcbnew.GetBoard()
  7. count = 0
  8. for track in pcb.GetTracks():
  9. #Set mask layer
  10. if type(track) == pcbnew.TRACK:
  11. if track.GetLayer() == pcbnew.F_Cu:
  12. maskLayer = pcbnew.F_Mask
  13. else:
  14. if(track.GetLayer() == pcbnew.B_Cu):
  15. maskLayer = pcbnew.B_Mask
  16. else:
  17. continue
  18. trackMask = pcbnew.TRACK(aParent=None, idtype=PCB_TRACE_T)
  19. trackMask.SetStart(track.GetStart())
  20. trackMask.SetEnd(track.GetEnd())
  21. trackMask.SetWidth(track.GetWidth())
  22. trackMask.SetLayer(maskLayer)
  23. pcb.Add(trackMask)
  24. count = count + 1
  25. print('{0} track masks added'.format(count))