Skip to content

Commit 0fb2422

Browse files
authored
Merge pull request #13 from sparkfun/release_candidate
v1.3.1
2 parents 874a6ef + f7f7116 commit 0fb2422

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

SparkFunKiCadPanelizer/panelizer/panelizer.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
215215
panelOutputFile = os.path.split(board.GetFileName())[1] # Get the file path tail
216216
panelOutputFile = os.path.join(panelOutputPath, os.path.splitext(panelOutputFile)[0] + "_panelized.kicad_pcb")
217217

218-
# Check if PCB needs to be saved
218+
# Check if PCB needs to be saved first
219219
#if board.IsModified(): # This doesn't work. Need to find something that does...
220220
if wx.GetApp() is not None:
221221
resp = wx.MessageBox("Do you want to save the PCB first?",
@@ -226,6 +226,18 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
226226
else:
227227
board.Save(board.GetFileName())
228228

229+
# Check if user wants to build zone fills
230+
if wx.GetApp() is not None:
231+
resp = wx.MessageBox("Do you want to build the zone fills?",
232+
'Fill zones?', wx.YES_NO | wx.ICON_INFORMATION)
233+
if resp == wx.YES:
234+
report += "Zones filled by user.\n"
235+
fillerTool = pcbnew.ZONE_FILLER(board)
236+
fillerTool.Fill(board.Zones())
237+
else:
238+
fillerTool = pcbnew.ZONE_FILLER(board)
239+
fillerTool.Fill(board.Zones())
240+
229241
if board is None:
230242
report += "Could not load board. Quitting.\n"
231243
sysExit = 2
@@ -522,14 +534,15 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
522534
ref = sourceModule.Reference().GetText()
523535
prodIDs.append([sourceModule.GetPropertyNative("PROD_ID"), ref])
524536
else: # Move source modules which are outside the bounding box
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)))):
527-
sourceModule.Move(pcbnew.VECTOR2I(0, int(HORIZONTAL_EDGE_RAIL_WIDTH * SCALE)))
528-
elif pos.y < boardTopEdge: # If the drawing is above the top edge, move it above the panel
537+
# If the module is below the bottom edge and likely to clip the rail, move it below the rail
538+
if pos.y > boardBottomEdge:
539+
if pos.y < (boardBottomEdge + (2 * int(HORIZONTAL_EDGE_RAIL_WIDTH * SCALE))):
540+
sourceModule.Move(pcbnew.VECTOR2I(0, int(HORIZONTAL_EDGE_RAIL_WIDTH * SCALE)))
541+
elif pos.y < boardTopEdge: # If the module is above the top edge, move it above the panel
529542
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
543+
elif pos.x > boardRightEdge: # If the module is to the right, move it beyond the panel
531544
sourceModule.Move(pcbnew.VECTOR2I(int(((NUM_X - 1) * boardWidth) + (VERTICAL_EDGE_RAIL_WIDTH * SCALE)), 0))
532-
else: # elif pos.x < boardLeftEdge: # If the drawing is to the left, move it outside the rail
545+
else: # elif pos.x < boardLeftEdge: # If the module is to the left, move it outside the rail
533546
sourceModule.Move(pcbnew.VECTOR2I(int(-VERTICAL_EDGE_RAIL_WIDTH * SCALE), 0))
534547

535548
for module in newModules:
@@ -620,12 +633,12 @@ def startPanelizer(self, args, board=None, ordering=None, logger=None):
620633
#if txt is not None: # Copy all text outside the bounding box to the report
621634
# report += txt + "\n"
622635
if pos.y > boardBottomEdge: # If the drawing is below the bottom edge, move it below the rail
623-
if pos.y < (boardBottomEdge + (HORIZONTAL_EDGE_RAIL_WIDTH * SCALE)): # But only if in the way
636+
if pos.y < (boardBottomEdge + (2 * int(HORIZONTAL_EDGE_RAIL_WIDTH * SCALE))): # But only if in the way
624637
sourceDrawing.Move(pcbnew.VECTOR2I(0, int(HORIZONTAL_EDGE_RAIL_WIDTH * SCALE)))
625-
elif pos.x > boardRightEdge: # If the drawing is to the right, move it beyond the panel
626-
sourceDrawing.Move(pcbnew.VECTOR2I(int(((NUM_X - 1) * boardWidth) + (VERTICAL_EDGE_RAIL_WIDTH * SCALE)), 0))
627638
elif pos.y < boardTopEdge: # If the drawing is above the top edge, move it above the panel
628639
sourceDrawing.Move(pcbnew.VECTOR2I(0, int((-(NUM_Y - 1) * boardHeight) - (HORIZONTAL_EDGE_RAIL_WIDTH * SCALE))))
640+
elif pos.x > boardRightEdge: # If the drawing is to the right, move it beyond the panel
641+
sourceDrawing.Move(pcbnew.VECTOR2I(int(((NUM_X - 1) * boardWidth) + (VERTICAL_EDGE_RAIL_WIDTH * SCALE)), 0))
629642
else: # elif pos.x < boardLeftEdge: # If the drawing is to the left, move it outside the rail
630643
sourceDrawing.Move(pcbnew.VECTOR2I(int(-VERTICAL_EDGE_RAIL_WIDTH * SCALE), 0))
631644

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.3.0"
1+
__version__ = "1.3.1"

0 commit comments

Comments
 (0)