+ // 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+cable_sep, 0, 0]) hull() {
+ translate([0, -batt_diam/2, 0])
+ cube([wall + eps, batt_diam, infty]);
+ rotate([0, 90, 0])
+ cylinder(r = batt_diam/2, h = wall+eps);
+ translate([0, batt_diam/2 - pcb_width,
+ -batt_diam/2-pcb_comp_h-pcb_thick])
+ cube([wall + eps, pcb_width, eps]);
+ translate([0, batt_diam/2 - pcb_width + 0.5*wall,
+ -batt_diam/2-2*pcb_comp_h-pcb_thick])
+ cube([wall + eps, pcb_width-0.5*wall, eps]);
+ };
+ // inner 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+wall, 0])
+ cube([cable_sep + eps, batt_diam-2*wall, infty]);
+ rotate([0, 90, 0])
+ cylinder(r = batt_diam/2-wall, h = cable_sep+eps);
+ };
+ // cable lead to battery contacts
+ for (x=[1, -1]) scale([x, 1, 1])
+ rotate([-140, 0, 0])
+ translate([batt_len/2-eps, -wire_thick/2, batt_diam/2-2.7])
+ cube([wall+cable_sep+2*eps, wire_thick, 5.4]);
+
+ // mounting holes
+ for(x=[-1,1]) scale([x, 1, 1])
+ translate([batt_len/2-mounthole_w/2, batt_diam/2+wall+mounthole_h/2, -infty/2])
+ scale([1, mounthole_h/mounthole_w, 1])
+ cylinder(r = mounthole_w/2, h = infty);
+ // grabbing gap
+ for(x=[-1,1]) scale([x, 1, 1])
+ translate([batt_len/2+cable_sep+wall+10, batt_diam/2-pcb_width/2, -batt_diam/2-2*pcb_comp_h-pcb_thick-wall-eps])
+ cylinder(r1 = 10, r2 = 10 - wall, h = wall + 2*eps);
+ // plus sign - vertical line
+ translate([batt_len/2 - 1.5*wall-plus_width/2, -plus_width/2, -batt_diam/2-wall])
+ cube([wall, plus_width, infty]);
+ // plus and minus signs - horizontal line
+ for(x=[-1,1]) scale([x, 1, 1])
+ translate([batt_len/2 - wall - plus_width, -wall/2, -batt_diam/2-wall])
+ cube([plus_width, wall, infty]);
+ };
+ // clip barrier
+ for (x = [-1, 1]) scale([x, 1, 1]) hull () {
+ translate([batt_len/2+wall+cable_sep-eps, batt_diam/2-pcb_width+wall/2+lid_sep,
+ -batt_diam/2-pcb_thick-pcb_comp_h + wall + lid_sep])
+ cube([wall+eps, pcb_width-2*wall-2*lid_sep, wall]);
+ translate([batt_len/2+wall+cable_sep-eps, batt_diam/2-pcb_width+3*wall/2+lid_sep,
+ -batt_diam/2-pcb_thick-pcb_comp_h + 3*wall + lid_sep])
+ cube([eps, pcb_width-4*wall-2*lid_sep, eps]);