+ // cable outlet
+ translate([-pcb_xoff-pcb_len/2-outwire_thick-wall, -6, 0])
+ rotate([40, 0, 0])
+ scale([2, 1, -1])
+ cylinder(r=outwire_thick/2, h = infty, $fn=12);
+ // space under the wire holes for battery contacts
+ translate([-batt_len/2-2*wall-cable_sep-eps, 0, 0])
+ difference() {
+ rotate([0, 90, 0])
+ cylinder(r = batt_diam/2-wall, h = batt_len + 4*wall + 2*cable_sep + 2*eps);
+ translate([-infty/2, -infty/2, -batt_end_h])
+ cube(infty);
+ };
+ // space above the wire holes for battery contacts
+ translate([-batt_len/2-2*wall-cable_sep-eps, -batt_diam/2, batt_end_h])
+ cube([batt_len + 4*wall + 2*cable_sep + 2*eps,
+ batt_diam,
+ batt_end_h]);
+ // wire holes for battery contacts
+ for (x = [-1, 1])
+ for (y = [-1, 1])
+ translate([-batt_len/2-wall-eps, x*wire_sep/2, y*wire_sep/2])
+ rotate([0, 90, 0])
+ cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6);
+ // wire hole from PCB to battery contacts
+ // translate([-batt_len/2-wall-eps, 0, -batt_diam/2-pcb_comp_h + wire_thick/2])
+ rotate([40, 0, 0])
+ translate([-batt_len/2-wall-eps, 0, -batt_diam/2 - wall/2 - wire_thick/2])
+ rotate([0, 90, 0])
+ cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6);
+ // hole behind the battery contacts
+ for(x=[1, -1])
+ scale([x, 1, 1]) translate([batt_len/2+wall, 0, 0]) hull() {
+ translate([0, -batt_diam/2, 0])
+ cube([wall + cable_sep + eps, batt_diam, infty]);
+ rotate([0, 90, 0])
+ cylinder(r = batt_diam/2, h = wall+cable_sep+eps);
+ translate([0, batt_diam/2 - pcb_width,
+ -batt_diam/2-pcb_comp_h-pcb_thick])
+ cube([wall + cable_sep + eps, pcb_width, eps]);
+ translate([cable_sep, batt_diam/2 - pcb_width + 1.5*wall,
+ -batt_diam/2-pcb_comp_h-pcb_thick-wall])
+ cube([wall + eps, pcb_width-2*wall, eps]);
+ };
+ // cable lead to battery contacts
+ for (x=[1, -1]) scale([x, 1, 1])
+ rotate([-140, 0, 0])
+ translate([batt_len/2+wire_thick/2, 0, batt_diam/2-2*wall])
+ cylinder(r=wire_thick/2, h = 5);