Skip to content

Commit 6780af1

Browse files
committed
Better reporting
1 parent 1eb95f9 commit 6780af1

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

SparkFunKiCadPanelizer/panelizer/panelizer.py

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
118118
# Minimum spacer for exposed edge panels
119119
MINIMUM_SPACER = 6.35 # mm
120120

121+
INVALID_WIDTH = 999999999
122+
121123
# 'Extra' ordering instructions
122124
# Any PCB_TEXT containing any of these keywords will be copied into the ordering instructions
123125
possibleExtras = ['clean', 'Clean', 'CLEAN']
@@ -390,8 +392,8 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
390392
# Array of tracks
391393
# Note: Duplicate uses the same net name for the duplicated track.
392394
# This creates DRC unconnected net errors. (KiKit does this properly...)
393-
minTrackWidth = 999999999
394-
minViaDrill = 999999999
395+
minTrackWidth = INVALID_WIDTH
396+
minViaDrill = INVALID_WIDTH
395397
tracks = board.GetTracks()
396398
newTracks = []
397399
for sourceTrack in tracks: # iterate through each track to be copied
@@ -1070,27 +1072,29 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
10701072
if material is not None:
10711073
report += material + "\n"
10721074
if solderMask is None:
1073-
solderMask = "Solder Mask: Red"
1075+
solderMask = "Solder Mask: Red (Default)"
10741076
report += solderMask + "\n"
10751077
if silkscreen is None:
1076-
silkscreen = "Silkscreen: White"
1078+
silkscreen = "Silkscreen: White (Default)"
10771079
report += silkscreen + "\n"
10781080
if numLayers is None:
1079-
numLayers = "Layers: 2"
1081+
numLayers = "Layers: 2 (Default)"
10801082
report += numLayers + "\n"
10811083
if finish is None:
1082-
finish = "Finish: HASL Lead-free"
1084+
finish = "Finish: HASL Lead-free (Default)"
10831085
report += finish + "\n"
10841086
if thickness is None:
1085-
thickness = "Thickness: 1.6mm"
1087+
thickness = "Thickness: 1.6mm (Default)"
10861088
report += thickness + "\n"
10871089
if copperWeight is None:
1088-
copperWeight = "Copper weight: 1oz"
1090+
copperWeight = "Copper weight: 1oz (Default)"
10891091
report += copperWeight + "\n"
1090-
report += "Minimum track width: {:.2f}mm ({:.2f}mil)\n".format(
1091-
float(minTrackWidth) / SCALE, float(minTrackWidth) * 1000 / (SCALE * 25.4))
1092-
report += "Minimum via drill: {:.2f}mm ({:.2f}mil)\n".format(
1093-
float(minViaDrill) / SCALE, float(minViaDrill) * 1000 / (SCALE * 25.4))
1092+
if minTrackWidth < INVALID_WIDTH:
1093+
report += "Minimum track width: {:.2f}mm ({:.2f}mil)\n".format(
1094+
float(minTrackWidth) / SCALE, float(minTrackWidth) * 1000 / (SCALE * 25.4))
1095+
if minViaDrill < INVALID_WIDTH:
1096+
report += "Minimum via drill: {:.2f}mm ({:.2f}mil)\n".format(
1097+
float(minViaDrill) / SCALE, float(minViaDrill) * 1000 / (SCALE * 25.4))
10941098
if orderingExtras is not None:
10951099
report += orderingExtras
10961100
else:
@@ -1110,66 +1114,69 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
11101114
if wx.GetApp() is not None and orderingInstructionsSeen:
11111115
resp = wx.MessageBox("Solder mask color not found!",
11121116
'Warning', wx.OK | wx.ICON_WARNING)
1113-
solderMask = "Solder Mask: Red"
1117+
solderMask = "Solder Mask: Red (Default)"
11141118
oi.write(solderMask + "\n")
11151119
if silkscreen is None:
11161120
if wx.GetApp() is not None and orderingInstructionsSeen:
11171121
resp = wx.MessageBox("Silkscreen color not found!",
11181122
'Warning', wx.OK | wx.ICON_WARNING)
1119-
silkscreen = "Silkscreen: White"
1123+
silkscreen = "Silkscreen: White (Default)"
11201124
oi.write(silkscreen + "\n")
11211125
if numLayers is None:
11221126
if wx.GetApp() is not None and orderingInstructionsSeen:
11231127
resp = wx.MessageBox("Number of layers not found!",
11241128
'Warning', wx.OK | wx.ICON_WARNING)
1125-
numLayers = "Layers: 2"
1129+
numLayers = "Layers: 2 (Default)"
11261130
oi.write(numLayers + "\n")
11271131
if finish is None:
11281132
if wx.GetApp() is not None and orderingInstructionsSeen:
11291133
resp = wx.MessageBox("PCB finish not found!",
11301134
'Warning', wx.OK | wx.ICON_WARNING)
1131-
finish = "Finish: HASL Lead-free"
1135+
finish = "Finish: HASL Lead-free (Default)"
11321136
oi.write(finish + "\n")
11331137
if thickness is None:
11341138
if wx.GetApp() is not None and orderingInstructionsSeen:
11351139
resp = wx.MessageBox("PCB thickness not found!",
11361140
'Warning', wx.OK | wx.ICON_WARNING)
1137-
thickness = "Thickness: 1.6mm"
1141+
thickness = "Thickness: 1.6mm (Default)"
11381142
oi.write(thickness + "\n")
11391143
if copperWeight is None:
11401144
if wx.GetApp() is not None and orderingInstructionsSeen:
11411145
resp = wx.MessageBox("Copper weight not found!",
11421146
'Warning', wx.OK | wx.ICON_WARNING)
1143-
copperWeight = "Copper weight: 1oz"
1147+
copperWeight = "Copper weight: 1oz (Default)"
11441148
oi.write(copperWeight + "\n")
1145-
oi.write("Minimum track width: {:.2f}mm ({:.2f}mil)\n".format(
1146-
float(minTrackWidth) / SCALE, float(minTrackWidth) * 1000 / (SCALE * 25.4)))
1147-
oi.write("Minimum via drill: {:.2f}mm ({:.2f}mil)\n".format(
1148-
float(minViaDrill) / SCALE, float(minViaDrill) * 1000 / (SCALE * 25.4)))
1149+
if minTrackWidth < INVALID_WIDTH:
1150+
oi.write("Minimum track width: {:.2f}mm ({:.2f}mil)\n".format(
1151+
float(minTrackWidth) / SCALE, float(minTrackWidth) * 1000 / (SCALE * 25.4)))
1152+
if minViaDrill < INVALID_WIDTH:
1153+
oi.write("Minimum via drill: {:.2f}mm ({:.2f}mil)\n".format(
1154+
float(minViaDrill) / SCALE, float(minViaDrill) * 1000 / (SCALE * 25.4)))
11491155
if orderingExtras is not None:
11501156
oi.write(orderingExtras)
11511157
except Exception as e:
11521158
# Don't throw exception if we can't save ordering instructions
11531159
pass
11541160

1155-
if (prodIDs is not None):
1161+
if len(prodIDs) > 0:
11561162
emptyProdIDs = {}
11571163
for prodID in prodIDs:
11581164
if (prodID[0] == '') or (prodID[0] == ' '):
11591165
if prodID[1] not in emptyProdIDs:
11601166
emptyProdIDs[prodID[1]] = 1
11611167
else:
11621168
emptyProdIDs[prodID[1]] = emptyProdIDs[prodID[1]] + 1
1163-
if wx.GetApp() is not None and orderingInstructionsSeen and emptyProdIDs:
1169+
if len(emptyProdIDs) > 0:
11641170
refs = ""
1165-
for keys, value in emptyProdIDs.items():
1171+
for ref, num in emptyProdIDs.items():
11661172
if refs == "":
1167-
refs += keys
1173+
refs += ref
11681174
else:
1169-
refs += "," + keys
1170-
resp = wx.MessageBox("Empty (undefined) PROD_IDs found!\n" + refs,
1171-
'Warning', wx.OK | wx.ICON_WARNING)
1172-
report += "Empty (undefined) PROD_IDs found!" + refs + "\n"
1175+
refs += "," + ref
1176+
if wx.GetApp() is not None and orderingInstructionsSeen:
1177+
resp = wx.MessageBox("Empty (undefined) PROD_IDs found!\n" + refs,
1178+
'Warning', wx.OK | wx.ICON_WARNING)
1179+
report += "Empty (undefined) PROD_IDs found: " + refs + "\n"
11731180
sysExit = 1
11741181

11751182
if sysExit < 0:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.0"
1+
__version__ = "1.0.1"

0 commit comments

Comments
 (0)