def pi_zero_backplate(): zero_plate = _zero_plate_base(support_height=ZERO_SUPPORT_HEIGHT_TOP, screw_offset=-.5) camera_plate = utils.cube_chamfered([ADAPTER_SIDE,ADAPTER_SIDE,ZERO_PLATE_HEIGHT],center=True,r=3) camera_plate = camera_plate + zero_plate screw_obj = MachineScrew(type=ScrewType.M2_HEX,length=ZERO_PLATE_HEIGHT*2,clearance=0) screw_bottom = rotate([180,0,0])(screw_obj()) screw_top = MachineScrew(type=ScrewType.M2_HEX,length=ZERO_PLATE_HEIGHT*2,overhang=True)() camera_plate = solid.difference()( camera_plate, # Upper plate mount screws translate((ADAPTER_SIDE/2-ADAPTER_HOLE_TO_SIDE,ADAPTER_SIDE/2-ADAPTER_HOLE_TO_SIDE,-ZERO_PLATE_HEIGHT/2))(screw_bottom), translate((-ADAPTER_SIDE/2+ADAPTER_HOLE_TO_SIDE,ADAPTER_SIDE/2-ADAPTER_HOLE_TO_SIDE,-ZERO_PLATE_HEIGHT/2))(screw_bottom), translate((ADAPTER_SIDE/2-ADAPTER_HOLE_TO_SIDE,-ADAPTER_SIDE/2+ADAPTER_HOLE_TO_SIDE,-ZERO_PLATE_HEIGHT/2))(screw_bottom), translate((-ADAPTER_SIDE/2+ADAPTER_HOLE_TO_SIDE,-ADAPTER_SIDE/2+ADAPTER_HOLE_TO_SIDE,-ZERO_PLATE_HEIGHT/2))(screw_bottom), # Lens ring mount screws translate((0,CS_LENS_RING_NUT_OFFSET,-ZERO_PLATE_HEIGHT/2))(screw_bottom), translate((0,-CS_LENS_RING_NUT_OFFSET,-ZERO_PLATE_HEIGHT/2))(screw_bottom), # Pi mount screws translate((ZERO_LENGTH/2-ZERO_SCREW_OFF,ZERO_WIDTH/2-ZERO_SCREW_OFF,-.5))(screw_top), translate((ZERO_LENGTH/2-ZERO_SCREW_OFF,-ZERO_WIDTH/2+ZERO_SCREW_OFF,-.5))(screw_top), translate((-ZERO_LENGTH/2+ZERO_SCREW_OFF,-ZERO_WIDTH/2+ZERO_SCREW_OFF,-.5))(screw_top), translate((-ZERO_LENGTH/2+ZERO_SCREW_OFF,ZERO_WIDTH/2-ZERO_SCREW_OFF,-.5))(screw_top), # flex cable opening translate((ZERO_LENGTH/2-ZERO_PLATE_TO_EDGE/2,0,0))(cube([ZERO_PLATE_TO_EDGE,13,ZERO_PLATE_HEIGHT],center=True)) ) # flex cable cover flex_cover = utils.cube_chamfered([ZERO_LENGTH,13,ZERO_PLATE_HEIGHT-1.5],center=True,r=3) camera_plate += translate((10,0,0.75))(flex_cover) camera_plate -= translate((ADAPTER_SIDE/2-1.5,0,0))(cube([3,13,ZERO_PLATE_HEIGHT],center=True)) camera_plate = rotate((180,0,0))(camera_plate) return camera_plate
def pi_bplus_a_backplate(height=2.5): support_height = 3 full_length = B_LENGTH width = B_WIDTH support_z = -support_height - height / 2 plate = utils.cube_chamfered([full_length, width, height], center=True, r=3) screw_top = MachineScrew(type=ScrewType.M2_HEX, length=support_height * 2, overhang=True)() support = solid.cylinder(d=6, h=support_height, center=False, segments=32) screw_x = full_length / 2 - B_SCREW_OFF plate = solid.union()( plate, translate((screw_x, width / 2 - B_SCREW_OFF, support_z))(support), translate((screw_x, -width / 2 + B_SCREW_OFF, support_z))(support), translate((screw_x - B_SCREW_DISTANCE_X, width / 2 - B_SCREW_OFF, support_z))(support), translate((screw_x - B_SCREW_DISTANCE_X, -width / 2 + B_SCREW_OFF, support_z))(support), ) plate = solid.difference()( plate, translate((screw_x, width / 2 - B_SCREW_OFF, 0))(screw_top), translate((screw_x, -width / 2 + B_SCREW_OFF, 0))(screw_top), translate((screw_x - B_SCREW_DISTANCE_X, -width / 2 + B_SCREW_OFF, 0))(screw_top), translate((screw_x - B_SCREW_DISTANCE_X, width / 2 - B_SCREW_OFF, 0))(screw_top), ) return plate
def pi_zero_frontplate(gpio_opening=True, flex_cover=True, support_height=3.7): height = ZERO_PLATE_HEIGHT plate = _zero_plate_base(support_height=support_height, screw_offset=0, height=height) screw_obj = MachineScrew(type=ScrewType.M2_HEX, length=height + support_height - 1, clearance=-0.2) screw = rotate([180, 0, 0])(screw_obj()) plate = solid.difference()( plate, translate( (ZERO_LENGTH / 2 - ZERO_SCREW_OFF, ZERO_WIDTH / 2 - ZERO_SCREW_OFF, -height / 2 - support_height))(screw), translate((ZERO_LENGTH / 2 - ZERO_SCREW_OFF, -ZERO_WIDTH / 2 + ZERO_SCREW_OFF, -height / 2 - support_height))(screw), translate((-ZERO_LENGTH / 2 + ZERO_SCREW_OFF, -ZERO_WIDTH / 2 + ZERO_SCREW_OFF, -height / 2 - support_height))(screw), translate((-ZERO_LENGTH / 2 + ZERO_SCREW_OFF, ZERO_WIDTH / 2 - ZERO_SCREW_OFF, -height / 2 - support_height))(screw), ) if flex_cover: flex_cover = utils.cube_chamfered([ZERO_LENGTH, 13, ZERO_PLATE_HEIGHT], center=True, r=3) plate += translate((10, 0, 0))(flex_cover) if gpio_opening: gpio_opening = translate( (0, ZERO_WIDTH / 2 - GPIO_WIDTH / 2 - GPIO_OFFSET, 0))(solid.cube([GPIO_LENGTH, GPIO_WIDTH, height], center=True)) plate -= gpio_opening return plate
def camera_flex_adapter(): plate = utils.cube_chamfered([ADAPTER_SIDE, ADAPTER_SIDE, ADAPTER_HEIGHT], center=False, r=3) screw_hole = MachineScrew(type=ScrewType.M2_HEX, length=ADAPTER_HEIGHT * 2, overhang=True)() screw_hole = rotate([180, 0, 0])(screw_hole) plate -= translate( (ADAPTER_HOLE_TO_SIDE, ADAPTER_HOLE_TO_SIDE, 1))(screw_hole()) plate -= translate( (ADAPTER_SIDE - ADAPTER_HOLE_TO_SIDE, 4, 1))(screw_hole()) plate -= translate( (4, ADAPTER_SIDE - ADAPTER_HOLE_TO_SIDE, 1))(screw_hole()) plate -= translate((ADAPTER_SIDE - ADAPTER_HOLE_TO_SIDE, ADAPTER_SIDE - ADAPTER_HOLE_TO_SIDE, 1))(screw_hole()) camera_body = solid.cube([CAMERA_SIDE, CAMERA_SIDE, ADAPTER_HEIGHT + 0.1], center=False)() camera_body += translate( (0, CAMERA_SIDE, ADAPTER_HEIGHT - 2))(cube([CAMERA_SIDE, 3.5, 2])) camera_body += translate(((CAMERA_SIDE - 6) / 2, CAMERA_SIDE + 2, ADAPTER_HEIGHT - 0.4))(cube([6, 16, 0.5])) camera_body = translate( (ADAPTER_SIDE / 2 - CAMERA_SIDE / 2, ADAPTER_SIDE / 2 - CAMERA_SIDE / 2, 0))(camera_body) plate -= camera_body plate -= translate((ADAPTER_SIDE / 2 - CS_LENS_RING_NUT_OFFSET, ADAPTER_SIDE / 2, -ADAPTER_HEIGHT / 2))(screw_hole) plate -= translate((ADAPTER_SIDE / 2 + CS_LENS_RING_NUT_OFFSET, ADAPTER_SIDE / 2, -ADAPTER_HEIGHT / 2))(screw_hole) return plate
def pi_bplus_a_frontplate(height=2.5, gpio_opening=True): support_height = 12 # This is basically only the aray from screw to screw, we only care about that area length = B_SCREW_DISTANCE_X + 2 * B_SCREW_OFF width = B_WIDTH support_z = -support_height - height / 2 plate = utils.cube_chamfered([length, width, height], center=True, r=3) screw_obj = MachineScrew(type=ScrewType.M2_HEX, length=support_height, clearance=-0.2) screw_bottom = rotate([180, 0, 0])(screw_obj()) support = solid.cylinder(d=6, h=support_height, center=False, segments=32) plate = solid.union()( plate, translate((length / 2 - B_SCREW_OFF, width / 2 - B_SCREW_OFF, support_z))(support), translate((length / 2 - B_SCREW_OFF, -width / 2 + B_SCREW_OFF, support_z))(support), translate((-length / 2 + B_SCREW_OFF, -width / 2 + B_SCREW_OFF, support_z))(support), translate((-length / 2 + B_SCREW_OFF, width / 2 - B_SCREW_OFF, support_z))(support), ) plate = solid.difference()( plate, # Upper plate mount screws translate((ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, -height / 2)) (screw_bottom), translate((-ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, -height / 2))(screw_bottom), translate((ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, -ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, -height / 2))(screw_bottom), translate((-ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, -ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, -height / 2))(screw_bottom), # Lens ring mount screws translate((CS_LENS_RING_NUT_OFFSET, 0, -height / 2))(screw_bottom), translate((-CS_LENS_RING_NUT_OFFSET, 0, -height / 2))(screw_bottom), # Pi mount screws translate((length / 2 - B_SCREW_OFF, width / 2 - B_SCREW_OFF, -support_height - screw_obj.head_h))(screw_bottom), translate((length / 2 - B_SCREW_OFF, -width / 2 + B_SCREW_OFF, -support_height - screw_obj.head_h))(screw_bottom), translate((-length / 2 + B_SCREW_OFF, -width / 2 + B_SCREW_OFF, -support_height - screw_obj.head_h))(screw_bottom), translate((-length / 2 + B_SCREW_OFF, width / 2 - B_SCREW_OFF, -support_height - screw_obj.head_h))(screw_bottom), # flex cable opening translate((0, ADAPTER_SIDE / 2 - 2.5, 0))(cube([16.5, 2, height], center=True))) if gpio_opening: gpio_opening = translate( (0.3, -(width / 2 - GPIO_WIDTH / 2 - 0.8), 0))(solid.cube([GPIO_LENGTH, GPIO_WIDTH, height], center=True)) plate -= gpio_opening return plate
def camera_rev_1_3_adapter(): height = 7.5 sensor_h = 3 sensor_w = 8.75 + 0.35 sensor_l = 8.65 + 0.35 module_w = 24 module_l = 25 sensor_y_off_top = 6.1 sensor_y_center_offset = (24 - 8.75) / 2 - sensor_y_off_top screw_top_y_offset = 9.4 screw_top_x_offset = 2.2 screw_bottom_y_offset = 1.8 screw_bottom_x_offset = 2 # led_bottom_offset_x = 4.4 # led_bottom_offset_y = 4.2 # sensor_y = PLATE_SIDE/2-sensor_w/2 - (PLATE_SIDE-module_l)/2-sensor_y_off # sensor_y = PLATE_SIDE/2-sensor_w/2 - (PLATE_SIDE-module_l)/2 -sensor_y_off_top plate = utils.cube_chamfered([ADAPTER_SIDE, ADAPTER_SIDE, height], center=True, r=3) plate = translate((0, 0, height / 2))(plate) sensor = cube([sensor_l, sensor_w, height + 0.1], center=True) conn_cutout = cube([sensor_l, module_w / 2 + 0.5, height], center=True) led_pocket = cylinder(segments=32, d=5, h=height, center=True) board = union()( translate((0, 0, height / 2 + sensor_h))(cube( [module_l + 0.5, module_w + 0.5, height], center=True)), # connector cutout translate((0, -module_w / 4, height / 2 + sensor_h - 2))(conn_cutout), # mounting screws translate((module_l / 2 - screw_top_x_offset, module_w / 2 - screw_top_y_offset, height / 2 + 0.4)) (cylinder(segments=32, d=2, h=height, center=True)), translate((-module_l / 2 + screw_top_x_offset, module_w / 2 - screw_top_y_offset, height / 2 + 0.4))(cylinder(segments=32, d=2, h=height, center=True)), translate((-module_l / 2 + screw_bottom_x_offset, -module_w / 2 + screw_bottom_y_offset, height / 2 + 0.4))(cylinder(segments=32, d=2, h=height, center=True)), translate((module_l / 2 - screw_bottom_x_offset, -module_w / 2 + screw_bottom_y_offset, height / 2 + 0.4))(cylinder(segments=32, d=2, h=height, center=True)), # smd led and resistor pocket translate((module_l / 2 - 5, -module_w / 2 + 3.75, sensor_h * 2 - 1)) (led_pocket), # led opening # translate((module_l/2-led_bottom_offset_x,-module_w/2+led_bottom_offset_y,0))(cylinder(segments=32,d=2,h=height,center=True)) ) screw_hole = MachineScrew(type=ScrewType.M2_HEX, length=height * 2, overhang=True, extend_head_height=height)() screw_hole = rotate([180, 0, 0])(screw_hole) plate = difference()( plate, translate((0, -sensor_y_center_offset))(board), # make space for flex cable translate((0, ADAPTER_SIDE / 4 - 1, height / 2 + sensor_h)) (cube([module_l + 0.5, ADAPTER_SIDE / 2, height], center=True)), sensor, # mounting screws translate((ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, 4))(screw_hole), translate((-ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, 4))(screw_hole), translate((ADAPTER_SIDE / 2 - ADAPTER_HOLE_TO_SIDE, -ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, 4))(screw_hole), translate((-ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, -ADAPTER_SIDE / 2 + ADAPTER_HOLE_TO_SIDE, 4))(screw_hole), # Lens ring mount screws translate((CS_LENS_RING_NUT_OFFSET, 0, -.4))(screw_hole), translate((-CS_LENS_RING_NUT_OFFSET, 0, -.4))(screw_hole), ) return plate