- translate([-batt_len/2 - wall - cable_sep - lid_sep, -batt_diam/2+lid_sep, -batt_diam/2 -wall])
- cube([batt_len + 2*wall + 2*cable_sep + 2*lid_sep, batt_diam-2*lid_sep, batt_diam/2 - batt_end_h + wall - lid_sep]);
- hull () {
- translate([-batt_len/2 - 2*wall - cable_sep,
- -batt_diam/2, -batt_diam/2-wall])
- cube([batt_len + 4*wall + 2*cable_sep,
- batt_diam, eps]);
- translate([-batt_len/2 - 3*wall - cable_sep,
- -batt_diam/2 - wall, -body_top_h-wall/2-lid_sep])
- cube([batt_len + 6*wall + 2*cable_sep,
- batt_diam + 2*wall, wall/2]);
- };
- // clip behind the battery contacts
- for(x=[1, -1])
- scale([x, 1, 1]) translate([batt_len/2+wall+cable_sep+lid_sep, 0, 0]) hull() {
- translate([0, -batt_diam/2+lid_sep, -batt_diam/2])
- cube([wall-lid_sep, batt_diam-2*lid_sep, eps]);
- rotate([0, 90, 0])
- cylinder(r = batt_diam/2-lid_sep, h = wall-lid_sep);
- translate([-clip_pretension, batt_diam/2 - pcb_width + 0.5*wall + lid_sep,
- batt_diam/2+pcb_comp_h+pcb_comp_h2+pcb_thick-lid_sep])
- cube([wall+clip_pretension, pcb_width-0.5*wall-1.5*lid_sep, eps]);
- };
- // outer part of the clip behind the battery contacts
- for (x=[1, -1]) scale([x, 1, 1]) translate([batt_len/2+2*wall+cable_sep+lid_sep, 0, 0]) hull() {
- translate([0, -batt_diam/2 - wall, -body_top_h-wall/2-lid_sep])
- cube([wall-lid_sep, batt_diam + 2*wall, wall/2]);
- difference() {
- scale([0.3, 1, 1])
- sphere(batt_diam/2+wall);
- translate([-infty/2, -infty/2, -infty-body_top_h-lid_sep+2*wall])
- cube(infty);
- translate([-infty-clip_pretension, -infty/2, -infty/2])
- cube(infty);
- };
- translate([-clip_pretension,
- batt_diam/2 - pcb_width,
- batt_diam/2+pcb_comp_h+pcb_comp_h2+pcb_thick+wall])
- cube([wall-lid_sep, pcb_width+wall, eps]);
+ // outer part
+ hull() {
+ // smaller outermost part
+ translate([-batt_len/2 - wall - cable_sep, -batt_diam/2, -batt_diam/2 - wall])
+ cube([batt_len + 2*wall + 2*cable_sep, batt_diam, eps]);
+ // this part goes above the main body
+ translate([-batt_len/2 - 2*wall - cable_sep, -batt_diam/2-wall, -body_top_h - lid_sep])
+ cube([batt_len + 4*wall + 2*cable_sep, batt_diam+2*wall, eps]);