Skip to content

Commit 622f674

Browse files
authored
Merge pull request #6 from sparkfun/release_candidate
v1.1.1 : add options to save the PCB and build the zone fills
2 parents 65113bf + f39baf0 commit 622f674

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

SparkFunKiCadCAMmer/cammer/cammer.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import datetime
66
import wx
77
import zipfile
8+
import pcbnew
89

910
from pcbnew import *
1011

@@ -97,12 +98,35 @@ def startCAMmer(self, args, board=None, logger=None):
9798
outputPath = os.path.split(sourceBoardFile)[0] # Get the file path head
9899
zipFilename = os.path.split(sourceBoardFile)[1] # Get the file path tail
99100
zipFilename = os.path.join(outputPath, os.path.splitext(zipFilename)[0] + ".zip")
101+
100102
else: # Running in a plugin
101103
sourceBoardFile = board.GetFileName()
102104
outputPath = os.path.split(sourceBoardFile)[0] # Get the file path head
103105
zipFilename = os.path.split(sourceBoardFile)[1] # Get the file path tail
104106
zipFilename = os.path.join(outputPath, os.path.splitext(zipFilename)[0] + ".zip")
105107

108+
# Check if PCB needs to be saved first
109+
if wx.GetApp() is not None:
110+
resp = wx.MessageBox("Do you want to save the PCB first?",
111+
'Save PCB?', wx.YES_NO | wx.ICON_INFORMATION)
112+
if resp == wx.YES:
113+
report += "Board saved by user.\n"
114+
board.Save(board.GetFileName())
115+
else:
116+
board.Save(board.GetFileName())
117+
118+
# Check if user wants to build zone fills
119+
if wx.GetApp() is not None:
120+
resp = wx.MessageBox("Do you want to build the zone fills?",
121+
'Fill zones?', wx.YES_NO | wx.ICON_INFORMATION)
122+
if resp == wx.YES:
123+
report += "Zones filled by user.\n"
124+
fillerTool = pcbnew.ZONE_FILLER(board)
125+
fillerTool.Fill(board.Zones())
126+
else:
127+
fillerTool = pcbnew.ZONE_FILLER(board)
128+
fillerTool.Fill(board.Zones())
129+
106130
if board is None:
107131
report += "Could not load board. Quitting.\n"
108132
sysExit = 2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.0"
1+
__version__ = "1.1.1"

0 commit comments

Comments
 (0)