-
Notifications
You must be signed in to change notification settings - Fork 1
/
dodecahedron_case.scad
248 lines (195 loc) · 4.3 KB
/
dodecahedron_case.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// dihedral angle
dA = 116.56505;
p_alpha = 90;
p_beta = 180 - dA;
p_gamma = 90 - p_beta;
pcb_radius = 17.2; // 85 for xhain dodecahedron
thickness = 5;
frame_thickness = 2;
window_thickness = 1.5;
pcb_thickness = 1.6;
radius = pcb_radius + frame_thickness;
pcb_window_radius = pcb_radius-window_thickness;
side_length = 2 * radius * sin(36);
height = side_length/2 * sqrt(5+2*sqrt(5));
inner_radius = side_length / 10 * sqrt(25+10*sqrt(5));
central_radius = (inner_radius + radius) /2;
p_sideA = inner_radius;
p_sideB = cos(p_gamma) * p_sideA;
p_sideC = cos(p_beta) * p_sideA;
p_height = cos(p_gamma) * height;
p_corner_height = cos(90-72) * side_length;
p_lower_height = cos(p_gamma) * p_corner_height;
echo("cube height: ", p_height + p_lower_height);
echo ();
echo (radius, inner_radius, side_length, height);
echo ();
echo (p_alpha, p_beta, p_gamma);
echo (p_sideA, p_sideB, p_sideC);
module pentagonPlate (radius, thickness, inner_radius, cut_edge)
{
difference() {
//union() {
cube_len = 2 * radius;
cube_width = 2 * thickness;
cylinder(thickness, radius, radius, $fn=5);
if (cut_edge) union() {
for(i = [0:4])
{
// debugging color
color("red", 0.5)
// move all five pieces to right spot
rotate(72*i)
// move cutting cube to inner radius
translate([-inner_radius, 0, 0])
// rotate by dihedral angle of dodecahedron
// rotate([ 0, dA, 0])
rotate([ 0, 180-dA/2, 0])
{
// move cube to negative coordinates for better rotation
translate([-cube_width, -cube_len/2, -cube_width])
// draw the corner cutting cube
cube([cube_width, cube_len, cube_width]);
// magnet
translate([-thickness+.5, 0,-cube_width])
cylinder(40,1.1,1.1, $fn=25);
}
}
}
// cut out for pcbs
//*
internal = false;
if (internal) {
color("red", .25) {
translate([0,0,-1])
cylinder(
2,
pcb_window_radius,
pcb_window_radius,
$fn= 5
);
translate([0,0,1])
cylinder(
thickness,
pcb_radius,
pcb_radius,
$fn=5
);
}
}
else {
color("red", .25) {
translate([0,0,pcb_thickness])
cylinder(
pcb_thickness+thickness,
pcb_window_radius,
pcb_window_radius-thickness/2,
$fn= 5
);
translate([0,0,-.2])
cylinder(
pcb_thickness+.4,
pcb_radius-.25,
pcb_radius+.1,
$fn=5
);
}
}
/**/
}
}
if(0)
translate([0,0,.2])
color("green", .1)
cylinder(
pcb_thickness,
pcb_radius,
pcb_radius,
$fn=5
);
module halfshell(){
union() {
// color("red", .25)
pentagonPlate(radius, thickness, inner_radius, true);
if (true) for (i=[0:4])
{
rotate([0,0,72*i])
{
if (false)
{
/* drawing mounting screw holes */
pole_h = (p_height + p_lower_height)/2;
// pole_h = 8;
pole_r1 = 1;
pole_r2 = 5;
translate([central_radius+pole_r1, 0, thickness])
cylinder(pole_h, pole_r1, pole_r2, $fn=20);
}
/* drawing angled pentagons */
//*
translate([
-(p_sideC + inner_radius),
0,
p_sideB
])
/**/
rotate([180, -dA, 0])
pentagonPlate(radius, thickness, inner_radius, true);
}
}
}
}
module other_halfshell()
{
translate([0,0,(p_height + p_lower_height)])
rotate([180,0,36])
halfshell();
}
module nokia()
{
x=5.7; y=34; z=53.1;
color("blue") translate([-x/2,-y/2,0]) cube([x,y,z]);
}
module b653450()
{
x=6.5; y=34; z=50;
color("blue") translate([-x/2,-y/2,0]) cube([x,y,z]);
}
module b903052()
{
x=9; y=30; z=52;
color("green") translate([-x/2,-y/2,0]) cube([x,y,z]);
}
module b903440()
{
x=9; y=34; z=40;
echo ("height" , p_height + p_lower_height);
color("green") translate([-x/2,-y/2,(p_height + p_lower_height-z)/2]) cube([x,y,z]);
}
module battery(x,y,z){
x=x/10;
translate([-x/2,-y/2,(p_height + p_lower_height-z)/2]) cube([x,y,z]);
}
module round_battery(d,z){
r=d/2;
translate([0,0,(p_height + p_lower_height-z)/2]) cylinder(z,r,r);
}
// pentagonPlate(radius, thickness, inner_radius, true);
halfshell();
// translate([0,0,20])
color("green", .3)
other_halfshell();
/*
// battery(40,30,40);
color("green")
battery(102,27,31); // 800
color("blue")
battery(90,28,31); // 850
color("yellow")
battery(90,35,35);
round_battery(20,40);
//battery(30,48,55);
// b903052();
// b903440();
// nokia();
*/