Browse Source

Merge remote-tracking branch 'GitLab/master'

Gareth O'Brien 7 years ago
parent
commit
6e512aec80
1 changed files with 30 additions and 0 deletions
  1. 30 0
      et.py

+ 30 - 0
et.py

@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# Expose track for pcbnew
+
+import pcbnew
+
+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.TRACK(aParent=None, idtype=PCB_TRACE_T)
+            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))