-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolar_battery_box.scad
83 lines (71 loc) · 2.59 KB
/
solar_battery_box.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$fs=0.2;
// NOTE: length/width/height are exterior dimensions. Interior dimensions
// are thick*2 smaller than these.
length = 85; //4.1 * 25.4;
width= 48; //3.1 * 25.4;
height = 30; //1.6 * 25.4;
cornerRadius = 3;
slop = 0.1;
thick = 2.0;
wireRadius = 2.7;
lidRimHeight = 4;
// Not sure why, but the side hole comes out wider than the diameter of the end hole.
sideWireWidthScale = (5/7);
lidSlop = 0.2; // the rim on the lid will be this much smaller than the box
centerWidth = width/2-cornerRadius;
translate([cornerRadius, cornerRadius, 0]){
difference() {
roundedBox(length, width, height, cornerRadius);
translate([thick,thick,thick+slop])
roundedBox(length-thick*2, width-thick*2, height-thick+slop, cornerRadius);
// Hole for wires
translate([centerWidth, -thick/3, height-wireRadius])
rotate([90,0,0])
cylinder(r=wireRadius, h=thick*2);
translate([centerWidth-wireRadius, -thick/3, height-wireRadius+.2])
rotate([90,0,0])
cube(size=[wireRadius*2, wireRadius+.2, thick*2], center=false);
translate([-thick*2, length/1.4, height-wireRadius])
rotate([0,90,0])
scale([1, sideWireWidthScale, 1])
cylinder(r=wireRadius, h=thick*2);
translate([-thick*2, length/1.4-wireRadius*sideWireWidthScale, height+.2])
rotate([0,90,0])
cube(size=[wireRadius+.2, wireRadius*2*sideWireWidthScale, thick*2], center=false);
}
}
// Make the lid
lidThick = thick + lidSlop/2;
translate([width*2+5, cornerRadius, 0]){
mirror([1,0,0]) {
roundedBox(length, width, thick, cornerRadius);
difference() {
translate([lidThick, lidThick, 0])
roundedBox(length-lidThick*2, width-lidThick*2, thick+lidRimHeight, cornerRadius);
translate([lidThick*2, lidThick*2, 0+slop])
roundedBox(length-lidThick*4, width-lidThick*4, thick+lidRimHeight+slop, cornerRadius);
// Hole for wires
translate([width/2-wireRadius, lidThick+.2, thick*3])
rotate([90,0,0])
cylinder(r=wireRadius, h=lidThick*2);
translate([-lidThick + .2, length/1.4, thick*3])
rotate([0,90,0])
scale([1, sideWireWidthScale, 1])
cylinder(r=wireRadius, h=lidThick*2);
}
}
}
module roundedBox(length, width, height, radius){
dRadius = 2*radius;
//cube bottom right
//translate([width-dRadius,-radius,0])
// cube(size=[radius,radius,height+0.01]);
//cube top left
//translate([-radius,length-dRadius,0])
// cube(size=[radius,radius,height+0.01]);
//base rounded shape
minkowski() {
cube(size=[width-dRadius,length-dRadius, height]);
cylinder(r=radius, h=0.01);
}
}