Ejemplo n.º 1
0
def place_switches(c):
    OFFSET = wxPoint(FromMM(100), FromMM(50))
    KEY_DISTANCE = 19.05

    b = LoadBoard(KICAD_PCB)
    for row in range(5):
        for col in range(6):
            i = col + 6 * row + 1
            m = b.FindModuleByReference(f"SW{i}")
            x = FromMM(KEY_DISTANCE * col)
            y = FromMM(KEY_DISTANCE) * row
            m.SetPosition(wxPoint(x, y) + OFFSET)

            m = b.FindModuleByReference(f"D{i}")
            x = FromMM(KEY_DISTANCE) * col + FromMM(KEY_DISTANCE) / 2
            y = FromMM(KEY_DISTANCE) * row
            m.SetPosition(wxPoint(x, y) + OFFSET)
            m.SetOrientation(270 * 10)

    b.Save(b.GetFileName())
Ejemplo n.º 2
0
boardcount = 0
# global variable is fine here for counting boards

# instantiate boards @ different rotations
for angle in angles:
    pcb_instanciate_multiple_boards(pcb, lsItems, nx, ny, step_vector,
                                    offset_vector, angle, center)

print("Instantiate %i boards\n" % boardcount)

# try to load and add common parts
print("trying to read file: '%s'\n" % fileNameCommonParts)
try:
    pcb_common = LoadBoard(fileNameCommonParts)
    print("\n")
except:
    print("File '%s' not found, Ignoring common parts\n" % fileNameCommonParts)
    pass
else:
    # get all items
    lsItems_common = brdItemize(pcb_common)

    # add common parts

    print("Add common parts from file: '%s'\n" % fileNameCommonParts)
    pcb_instanciate_one_board(pcb, lsItems_common, wxPt(0, 0), 0, wxPt(0, 0))

# save finished panel
print("\nSave panel to file:'%s'\n" % fileNameSave)
pcb.Save(fileNameSave)