from cad_shapes import * import math square_size = 1.0; # square size of 2"x 2" spacing = .1 #spacing dim = 3 size = dim * square_size size = size/2.0 cad.xmin = -size; cad.xmax = size + (dim+1)*spacing; cad.ymin = -size; cad.ymax = size + (dim+1)*spacing; cad.mm_per_unit = 25.4 # inch units slot_width = .145 slot_height = square_size/5.0; slot_chamfer = .2 slot_top = slot(square_size/2, 0, slot_width, slot_height, 180, slot_chamfer) slot_bottom = slot(square_size/2, square_size, slot_width, slot_height, 0, slot_chamfer) slot_left = slot(0, square_size/2, slot_width, slot_height, 90, slot_chamfer) slot_right = slot(square_size, square_size/2, slot_width, slot_height, -90, slot_chamfer) rectangle = rectangle(0, square_size, 0, square_size) piece = subtract(rectangle, slot_top) piece = subtract(piece, slot_bottom) piece = subtract(piece, slot_left) piece = subtract(piece, slot_right) pieces = move(piece, -size+spacing, -size+spacing) x=[] jump = -size+spacing; for i in range(0,dim): x.append(jump) jump = jump + square_size + spacing for i in x: for j in x: pieces = add(pieces, move(piece,i,j)) cad.function = pieces