@@ -148,14 +148,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
148
148
# Any PCB_TEXT containing any of these keywords will be copied into the ordering instructions
149
149
possibleExtras = ['clean' , 'Clean' , 'CLEAN' , 'stackup' , 'Stackup' , 'STACKUP' ]
150
150
151
- # Permutations for Ordering Instructions
152
- possibleOrderingInstructions = [
153
- "Ordering_Instructions" ,
154
- "ORDERING_INSTRUCTIONS" ,
155
- "Ordering Instructions" ,
156
- "ORDERING INSTRUCTIONS"
157
- ]
158
-
159
151
sysExit = - 1 # -1 indicates sysExit has not (yet) been set. The code below will set this to 0, 1, 2.
160
152
report = "\n START: " + datetime .now ().isoformat () + "\n "
161
153
@@ -368,9 +360,10 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
368
360
cutWidth = 0
369
361
drawings = board .GetDrawings ()
370
362
for drawing in drawings :
371
- if drawing .IsOnLayer (edgeLayerNumber ):
372
- if drawing .GetWidth () > cutWidth :
373
- cutWidth = drawing .GetWidth ()
363
+ if hasattr (drawing , "IsOnLayer" ) and hasattr (drawing , "GetWidth" ):
364
+ if drawing .IsOnLayer (edgeLayerNumber ):
365
+ if drawing .GetWidth () > cutWidth :
366
+ cutWidth = drawing .GetWidth ()
374
367
#report += "Subtracting Edge.Cuts line width of {}mm.\n".format(cutWidth / SCALE)
375
368
boardWidth -= cutWidth
376
369
boardHeight -= cutWidth
@@ -443,7 +436,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
443
436
if PANEL_X or PANEL_Y :
444
437
report += "You can fit " + str (NUM_X ) + " x " + str (NUM_Y ) + " boards on the panel.\n "
445
438
446
- orderingInstructionsSeen = False
447
439
sparkfunLogoSeen = False
448
440
sparkxLogoSeen = False
449
441
solderMask = None
@@ -495,9 +487,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
495
487
newModules = []
496
488
prodIDs = []
497
489
for sourceModule in modules :
498
- for instruction in possibleOrderingInstructions :
499
- if instruction in sourceModule .GetFPIDAsString ():
500
- orderingInstructionsSeen = True
501
490
if "SparkFun_Logo" in sourceModule .GetFPIDAsString ():
502
491
sparkfunLogoSeen = True
503
492
if "SparkX_Logo" in sourceModule .GetFPIDAsString ():
@@ -533,12 +522,13 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
533
522
ref = sourceModule .Reference ().GetText ()
534
523
prodIDs .append ([sourceModule .GetPropertyNative ("PROD_ID" ), ref ])
535
524
else : # Move source modules which are outside the bounding box
536
- if pos .y > boardBottomEdge : # If the drawing is below the bottom edge, move it below the rail
525
+ # If the drawing is below the bottom edge and likely to clip the rail, move it below the rail
526
+ if (pos .y > boardBottomEdge ) and (pos .y < (boardBottomEdge + (2 * int (HORIZONTAL_EDGE_RAIL_WIDTH * SCALE )))):
537
527
sourceModule .Move (pcbnew .VECTOR2I (0 , int (HORIZONTAL_EDGE_RAIL_WIDTH * SCALE )))
538
- elif pos .x > boardRightEdge : # If the drawing is to the right, move it beyond the panel
539
- sourceModule .Move (pcbnew .VECTOR2I (int (((NUM_X - 1 ) * boardWidth ) + (VERTICAL_EDGE_RAIL_WIDTH * SCALE )), 0 ))
540
528
elif pos .y < boardTopEdge : # If the drawing is above the top edge, move it above the panel
541
529
sourceModule .Move (pcbnew .VECTOR2I (0 , int ((- (NUM_Y - 1 ) * boardHeight ) - (HORIZONTAL_EDGE_RAIL_WIDTH * SCALE ))))
530
+ elif pos .x > boardRightEdge : # If the drawing is to the right, move it beyond the panel
531
+ sourceModule .Move (pcbnew .VECTOR2I (int (((NUM_X - 1 ) * boardWidth ) + (VERTICAL_EDGE_RAIL_WIDTH * SCALE )), 0 ))
542
532
else : # elif pos.x < boardLeftEdge: # If the drawing is to the left, move it outside the rail
543
533
sourceModule .Move (pcbnew .VECTOR2I (int (- VERTICAL_EDGE_RAIL_WIDTH * SCALE ), 0 ))
544
534
@@ -1190,13 +1180,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
1190
1180
sysExit = 1
1191
1181
1192
1182
# Add ordering instructions:
1193
- if not orderingInstructionsSeen :
1194
- if wx .GetApp () is not None :
1195
- resp = wx .MessageBox ("Ordering Instructions not found!\n No futher warnings will be given." ,
1196
- 'Warning' , wx .OK | wx .ICON_WARNING )
1197
- report += "Ordering Instructions not found! No futher ordering warnings will be given.\n "
1198
- sysExit = 1
1199
-
1200
1183
if ordering is None :
1201
1184
report += "\n Ordering Instructions:\n "
1202
1185
report += (
@@ -1236,6 +1219,7 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
1236
1219
report += orderingExtras
1237
1220
else :
1238
1221
try :
1222
+ defaultsUsed = False
1239
1223
with open (ordering , 'w' ) as oi :
1240
1224
oi .write ("Ordering Instructions:\n " )
1241
1225
oi .write (
@@ -1248,39 +1232,27 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
1248
1232
if material is not None :
1249
1233
oi .write (material + "\n " )
1250
1234
if solderMask is None :
1251
- if wx .GetApp () is not None and orderingInstructionsSeen :
1252
- resp = wx .MessageBox ("Solder mask color not found!" ,
1253
- 'Warning' , wx .OK | wx .ICON_WARNING )
1235
+ defaultsUsed = True
1254
1236
solderMask = "Solder Mask: Red (Default)"
1255
1237
oi .write (solderMask + "\n " )
1256
1238
if silkscreen is None :
1257
- if wx .GetApp () is not None and orderingInstructionsSeen :
1258
- resp = wx .MessageBox ("Silkscreen color not found!" ,
1259
- 'Warning' , wx .OK | wx .ICON_WARNING )
1239
+ defaultsUsed = True
1260
1240
silkscreen = "Silkscreen: White (Default)"
1261
1241
oi .write (silkscreen + "\n " )
1262
1242
if copperLayers is None :
1263
- if wx .GetApp () is not None and orderingInstructionsSeen :
1264
- resp = wx .MessageBox ("Number of layers not found!" ,
1265
- 'Warning' , wx .OK | wx .ICON_WARNING )
1243
+ defaultsUsed = True
1266
1244
copperLayers = "Layers: 2 (Default)"
1267
1245
oi .write (copperLayers + "\n " )
1268
1246
if finish is None :
1269
- if wx .GetApp () is not None and orderingInstructionsSeen :
1270
- resp = wx .MessageBox ("PCB finish not found!" ,
1271
- 'Warning' , wx .OK | wx .ICON_WARNING )
1247
+ defaultsUsed = True
1272
1248
finish = "Finish: HASL Lead-free (Default)"
1273
1249
oi .write (finish + "\n " )
1274
1250
if thickness is None :
1275
- if wx .GetApp () is not None and orderingInstructionsSeen :
1276
- resp = wx .MessageBox ("PCB thickness not found!" ,
1277
- 'Warning' , wx .OK | wx .ICON_WARNING )
1251
+ defaultsUsed = True
1278
1252
thickness = "Thickness: 1.6mm (Default)"
1279
1253
oi .write (thickness + "\n " )
1280
1254
if copperWeight is None :
1281
- if wx .GetApp () is not None and orderingInstructionsSeen :
1282
- resp = wx .MessageBox ("Copper weight not found!" ,
1283
- 'Warning' , wx .OK | wx .ICON_WARNING )
1255
+ defaultsUsed = True
1284
1256
copperWeight = "Copper weight: 1oz (Default)"
1285
1257
oi .write (copperWeight + "\n " )
1286
1258
if minTrackWidth < INVALID_WIDTH :
@@ -1291,6 +1263,9 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
1291
1263
float (minViaDrill ) / SCALE , float (minViaDrill ) * 1000 / (SCALE * 25.4 )))
1292
1264
if orderingExtras is not None :
1293
1265
oi .write (orderingExtras )
1266
+ if defaultsUsed :
1267
+ report += "Warning: Ordering Instructions contains default values.\n "
1268
+ sysExit = 1
1294
1269
except Exception as e :
1295
1270
# Don't throw exception if we can't save ordering instructions
1296
1271
pass
@@ -1310,7 +1285,7 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
1310
1285
refs += ref
1311
1286
else :
1312
1287
refs += "," + ref
1313
- if wx .GetApp () is not None and orderingInstructionsSeen :
1288
+ if wx .GetApp () is not None :
1314
1289
resp = wx .MessageBox ("Empty (undefined) PROD_IDs found!\n " + refs ,
1315
1290
'Warning' , wx .OK | wx .ICON_WARNING )
1316
1291
report += "Empty (undefined) PROD_IDs found: " + refs + "\n "
0 commit comments