-
Notifications
You must be signed in to change notification settings - Fork 4
/
AlClosure.scad
142 lines (114 loc) · 3.54 KB
/
AlClosure.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//
// AlClosure
// A Beautiful Professional Screwless Aluminum Device Enclosure
// Version 1.0.0
//
// (c) 2021 [email protected]
//
// License: CC BY-SA 4.0
// Createive Commons Attribution-ShareAlike 4.0 International
// https://creativecommons.org/licenses/by-sa/4.0/legalcode
//
// outer dimensions of final enclosure
outerW = 300;
outerH = 60;
outerD = 150;
// 💡 known-good ratios side thickness + screws
// 5mm sides and M2 screws
// 6mm sides and M2.5 screws
// 8mm sides and M3 screws
// sheet metal thickness of top, bottom, front & back panel
// 💡 Recommended to use anodized aluminum for front + back
panelThickness = 2;
// thickness of sheet metal for sides
sideThickness = 6;
// slot milling distance from side's edge
// 💡 less than 1.5mm not practical
millDistancefromEdge = max(sideThickness / 4, 1.5);
// M3 thread + screws
// threadSize = 3;
// threadBore = 2.5;
// counterSinkOuter = 6 / 2;
// coutnerSinkHeight = 1.65;
// M2.5 thread + screws
threadSize = 2.5;
threadBore = 2.0;
counterSinkOuter = 4.7 / 2;
coutnerSinkHeight = 1.5;
// M2 thread + screws
// threadSize = 2;
// threadBore = 1.6;
// counterSinkOuter = 3.8 / 2;
// coutnerSinkHeight = 1.2;
threadPosition = outerD * 0.15; // 💡 15% inwards is mostly nice
threadDepth = 15;
tolerance = 0.1; // used for width of front/back panels
// colors
aluminum = [0.9, 0.9, 0.9];
steel = [0.8, 0.8, 0.9];
steelSeeThrough = [0.8, 0.8, 0.9, 0.8];
module sideThread() {
cylinder(r = threadBore / 2, h = threadDepth, center = false, $fn = 40);
}
module sideThreads(d, sideThickness) {
for(y = [threadPosition, d - threadPosition])
translate([sideThickness / 2, y, 0])
sideThread();
}
module sideSlot(h, materialThickness, panel, center = false) {
millDepth = materialThickness / 2;
cube([millDepth, panel, h], center);
}
module side(h, d, center = false) {
difference() {
cube([sideThickness, d, h], center);
// slots
for (y = [millDistancefromEdge, d - 2 * millDistancefromEdge])
translate([0, y, 0])
sideSlot(h, sideThickness, panelThickness);
// threads
for(z = [0, h - threadDepth])
translate([0, 0, z])
sideThreads(d, sideThickness);
}
}
module panel() {
color(steel)
cube([outerW - (sideThickness) - tolerance * 2, panelThickness, outerH], center = false);
}
module screwHead() {
cylinder(h = coutnerSinkHeight, r1 = counterSinkOuter, r2 = threadSize / 2, center = false, $fn = 40);
}
module cover() {
difference() {
cube([outerW, outerD, panelThickness], center = false);
for(x = [sideThickness / 2, outerW - sideThickness / 2],
y = [threadPosition, outerD - threadPosition])
{
translate([x, y, 0]) {
sideThread();
screwHead();
}
}
}
}
// left side
translate([sideThickness, 0, outerH])
rotate([0, 180, 0])
color(aluminum) side(outerH, outerD);
// right side
translate([outerW - sideThickness, 0, 0])
color(aluminum) side(outerH, outerD);
// fontpanel
translate([sideThickness / 2 + tolerance, millDistancefromEdge, 0])
color("lightgreen") panel();
// backpanel
translate([sideThickness / 2 + tolerance, outerD - millDistancefromEdge - panelThickness, 0])
panel();
// bottom cover
translate([0, 0, 0 - panelThickness])
color(steel) cover();
// top cover
rotate([180, 0, 180])
translate([0 - outerW, 0, 0 - outerH - panelThickness])
color(steelSeeThrough) cover();