123456789101112131415161718192021222324252627282930313233343536373839 |
- #!/usr/bin/env python
- # Expose track for pcbnew
- import collections
- from collections import defaultdict, Counter
- from itertools import compress,izip, cycle
- import itertools
- import pcbnew
- import time
- import os, sys
- import math
- import re
- from textwrap import wrap
- import wx
- def AddMask():
- #Copy track to mask layer
- pcb = pcbnew.GetBoard()
- count = 0
- for track in pcb.GetTracks():
- #Set mask layer
- if type(track) == pcbnew.TRACK:
- if track.GetLayer() == pcbnew.F_Cu:
- maskLayer = pcbnew.F_Mask
- else:
- # if(track.GetLayer() == pcbnew.B_Cu):
- # maskLayer = pcbnew.B_Mask
- # else:
- continue
- trackMask = pcbnew.DRAWSEGMENT(pcb)
- trackMask.SetStart(track.GetStart())
- trackMask.SetEnd(track.GetEnd())
- trackMask.SetWidth(track.GetWidth())
- trackMask.SetLayer(maskLayer)
- pcb.Add(trackMask)
- count = count + 1
- print('{0} track masks added'.format(count))
|