|
5 | 5 | from datetime import datetime
|
6 | 6 | import wx
|
7 | 7 | import zipfile
|
| 8 | +import pcbnew |
8 | 9 |
|
9 | 10 | from pcbnew import *
|
10 | 11 |
|
@@ -97,12 +98,35 @@ def startCAMmer(self, args, board=None, logger=None):
|
97 | 98 | outputPath = os.path.split(sourceBoardFile)[0] # Get the file path head
|
98 | 99 | zipFilename = os.path.split(sourceBoardFile)[1] # Get the file path tail
|
99 | 100 | zipFilename = os.path.join(outputPath, os.path.splitext(zipFilename)[0] + ".zip")
|
| 101 | + |
100 | 102 | else: # Running in a plugin
|
101 | 103 | sourceBoardFile = board.GetFileName()
|
102 | 104 | outputPath = os.path.split(sourceBoardFile)[0] # Get the file path head
|
103 | 105 | zipFilename = os.path.split(sourceBoardFile)[1] # Get the file path tail
|
104 | 106 | zipFilename = os.path.join(outputPath, os.path.splitext(zipFilename)[0] + ".zip")
|
105 | 107 |
|
| 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 | + |
106 | 130 | if board is None:
|
107 | 131 | report += "Could not load board. Quitting.\n"
|
108 | 132 | sysExit = 2
|
|
0 commit comments