def pcb_instanciate_multiple_boards(pcb, lsItems, nx, ny, step_vector, offset_vector, angle, center): if nx<1 or(ny<1): raise ValueError, "Columns(%i) or Rows(%i) cannot be less than 1…" % (nx, ny) for y in range(ny): for x in range(nx): vector_to_place = wxPt(x*step_vector.x + offset_vector.x, y*step_vector.y + offset_vector.y) pcb_instanciate_one_board(pcb, lsItems, vector_to_place, angle, center) return
def pcb_instanciate_multiple_boards(pcb, lsItems, nx, ny, step_vector, offset_vector, angle, center): if nx < 1 or (ny < 1): raise (ValueError, "Columns(%i) or Rows(%i) cannot be less than 1…" % (nx, ny)) for y in range(ny): for x in range(nx): vector_to_place = wxPt(x * step_vector.x + offset_vector.x, y * step_vector.y + offset_vector.y) pcb_instanciate_one_board(pcb, lsItems, vector_to_place, angle, center) return
return ############################################################################################## # panelizing script ############################################################################################## from pcbnew import LoadBoard, PCB_TEXT as PCB_TEXT, \ Edge_Cuts as Cutout, wxPoint as wxPt, FromMils, FromMM from os import path as pt import re # generate vectors from dimensions step_vector = wxPt(Units(step_x), Units(step_y)) offset_vector = wxPt(Units(offset_x), Units(offset_y)) center = wxPt(Units(center_x), Units(center_y)) # derived file names fileNameSave = "%s-panelized.%s" % tuple(fileNamePCB.rsplit('.', 1)) fileNameCommonParts = "%s-panel-common.%s" % tuple(fileNamePCB.rsplit('.', 1)) # load PCB print("Reading file: '%s'\n" % fileNamePCB) pcb = LoadBoard(fileNamePCB) print("\n") # get all items lsItems = brdItemize(pcb)
############################################################################################## # panelizing script ############################################################################################## from pcbnew import LoadBoard, TEXTE_PCB as TEXTE_PCB, DIMENSION as DIMN, \ Edge_Cuts as Cutout, wxPoint as wxPt, FromMils, FromMM, GetKicadConfigPath as cfgPath from os import path as pt import re # generate vectors from dimensions step_vector = wxPt(Units(step_x),Units(step_y)) offset_vector = wxPt(Units(offset_x),Units(offset_y)) center = wxPt(Units(center_x),Units(center_y)) # derived file names fileNameSave = "%s-panelized.%s" % tuple(fileNamePCB.rsplit('.', 1)) fileNameCommonParts = "%s-panel-common.%s" % tuple(fileNamePCB.rsplit('.', 1)) # load PCB print("Reading file: '%s'\n"% fileNamePCB) pcb = LoadBoard(fileNamePCB) print("\n") # get all items