57 lines
1.1 KiB
OpenSCAD
57 lines
1.1 KiB
OpenSCAD
|
include <libjuju.scad>;
|
||
|
|
||
|
module battery_holder(battery) {
|
||
|
wall = 2.5;
|
||
|
space = 4;
|
||
|
m = 3.5;
|
||
|
|
||
|
module clips(dim, wall) {
|
||
|
l = dim[0];
|
||
|
|
||
|
module clip() {
|
||
|
cylinder2([l/4, dim[1]+wall*2, dim[2]+wall*2]);
|
||
|
}
|
||
|
|
||
|
difference() {
|
||
|
union() {
|
||
|
translate([l*1/8, 0, 0])
|
||
|
clip();
|
||
|
translate([l*5/8, 0, 0])
|
||
|
clip();
|
||
|
}
|
||
|
translate([0, wall, wall])
|
||
|
cylinder2(dim);
|
||
|
translate([0, 0, dim[2]*0.7+wall])
|
||
|
cube(dim + [0, wall*2, 0]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module cap() {
|
||
|
difference() {
|
||
|
union() {
|
||
|
translate([0, 0, wall])
|
||
|
cylinder2([wall, battery[1], battery[2]]);
|
||
|
translate([0, 0, 0])
|
||
|
cube([wall, battery[1], battery[2]/2+wall]);
|
||
|
}
|
||
|
// Hole for the wire.
|
||
|
translate([-1, battery[1]/2 - m/2, battery[2]/2+wall/2])
|
||
|
cylinder2([wall+2, m, m]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module plate() {
|
||
|
union() {
|
||
|
cap();
|
||
|
translate([battery[0]+wall+space, 0, 0])
|
||
|
cap();
|
||
|
cube([battery[0]+wall*2+space, battery[1], wall]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
translate([0, wall, 0])
|
||
|
plate();
|
||
|
translate([(space+wall)/2, 0, 0])
|
||
|
clips(battery, wall);
|
||
|
}
|