@@ -148,14 +148,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
148148 # Any PCB_TEXT containing any of these keywords will be copied into the ordering instructions
149149 possibleExtras = ['clean' , 'Clean' , 'CLEAN' , 'stackup' , 'Stackup' , 'STACKUP' ]
150150
151- # Permutations for Ordering Instructions
152- possibleOrderingInstructions = [
153- "Ordering_Instructions" ,
154- "ORDERING_INSTRUCTIONS" ,
155- "Ordering Instructions" ,
156- "ORDERING INSTRUCTIONS"
157- ]
158-
159151 sysExit = - 1 # -1 indicates sysExit has not (yet) been set. The code below will set this to 0, 1, 2.
160152 report = "\n START: " + datetime .now ().isoformat () + "\n "
161153
@@ -368,9 +360,10 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
368360 cutWidth = 0
369361 drawings = board .GetDrawings ()
370362 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 ()
374367 #report += "Subtracting Edge.Cuts line width of {}mm.\n".format(cutWidth / SCALE)
375368 boardWidth -= cutWidth
376369 boardHeight -= cutWidth
@@ -443,7 +436,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
443436 if PANEL_X or PANEL_Y :
444437 report += "You can fit " + str (NUM_X ) + " x " + str (NUM_Y ) + " boards on the panel.\n "
445438
446- orderingInstructionsSeen = False
447439 sparkfunLogoSeen = False
448440 sparkxLogoSeen = False
449441 solderMask = None
@@ -495,9 +487,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
495487 newModules = []
496488 prodIDs = []
497489 for sourceModule in modules :
498- for instruction in possibleOrderingInstructions :
499- if instruction in sourceModule .GetFPIDAsString ():
500- orderingInstructionsSeen = True
501490 if "SparkFun_Logo" in sourceModule .GetFPIDAsString ():
502491 sparkfunLogoSeen = True
503492 if "SparkX_Logo" in sourceModule .GetFPIDAsString ():
@@ -533,12 +522,13 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
533522 ref = sourceModule .Reference ().GetText ()
534523 prodIDs .append ([sourceModule .GetPropertyNative ("PROD_ID" ), ref ])
535524 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 )))):
537527 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 ))
540528 elif pos .y < boardTopEdge : # If the drawing is above the top edge, move it above the panel
541529 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 ))
542532 else : # elif pos.x < boardLeftEdge: # If the drawing is to the left, move it outside the rail
543533 sourceModule .Move (pcbnew .VECTOR2I (int (- VERTICAL_EDGE_RAIL_WIDTH * SCALE ), 0 ))
544534
@@ -1190,13 +1180,6 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
11901180 sysExit = 1
11911181
11921182 # 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-
12001183 if ordering is None :
12011184 report += "\n Ordering Instructions:\n "
12021185 report += (
@@ -1236,6 +1219,7 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
12361219 report += orderingExtras
12371220 else :
12381221 try :
1222+ defaultsUsed = False
12391223 with open (ordering , 'w' ) as oi :
12401224 oi .write ("Ordering Instructions:\n " )
12411225 oi .write (
@@ -1248,39 +1232,27 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
12481232 if material is not None :
12491233 oi .write (material + "\n " )
12501234 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
12541236 solderMask = "Solder Mask: Red (Default)"
12551237 oi .write (solderMask + "\n " )
12561238 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
12601240 silkscreen = "Silkscreen: White (Default)"
12611241 oi .write (silkscreen + "\n " )
12621242 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
12661244 copperLayers = "Layers: 2 (Default)"
12671245 oi .write (copperLayers + "\n " )
12681246 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
12721248 finish = "Finish: HASL Lead-free (Default)"
12731249 oi .write (finish + "\n " )
12741250 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
12781252 thickness = "Thickness: 1.6mm (Default)"
12791253 oi .write (thickness + "\n " )
12801254 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
12841256 copperWeight = "Copper weight: 1oz (Default)"
12851257 oi .write (copperWeight + "\n " )
12861258 if minTrackWidth < INVALID_WIDTH :
@@ -1291,6 +1263,9 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
12911263 float (minViaDrill ) / SCALE , float (minViaDrill ) * 1000 / (SCALE * 25.4 )))
12921264 if orderingExtras is not None :
12931265 oi .write (orderingExtras )
1266+ if defaultsUsed :
1267+ report += "Warning: Ordering Instructions contains default values.\n "
1268+ sysExit = 1
12941269 except Exception as e :
12951270 # Don't throw exception if we can't save ordering instructions
12961271 pass
@@ -1310,7 +1285,7 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
13101285 refs += ref
13111286 else :
13121287 refs += "," + ref
1313- if wx .GetApp () is not None and orderingInstructionsSeen :
1288+ if wx .GetApp () is not None :
13141289 resp = wx .MessageBox ("Empty (undefined) PROD_IDs found!\n " + refs ,
13151290 'Warning' , wx .OK | wx .ICON_WARNING )
13161291 report += "Empty (undefined) PROD_IDs found: " + refs + "\n "
0 commit comments