-
Notifications
You must be signed in to change notification settings - Fork 5
/
camerabox.scad
462 lines (420 loc) · 17.5 KB
/
camerabox.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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
//smooth holes in rendering
$fn = 50;
/* Variables
------------------------------------------*/
// Laser surface
laser_x=1220;
laser_y=610;
// Nuts and bolts
case_bolt_d=3;
case_bolt_length=12;
case_nut_d=3;
case_nut_max_width=case_nut_d*2;
case_nut_min_width=case_nut_d*1.8;
case_nut_height=case_nut_d*0.9;
// Case size
acrylic=6;
case_width=438.15;//17.25" rack unit width
case_height=88.1;//2U rack height
case_depth=304.8;//1/2 24" rack depth
bottom_panel_width=case_width;
side_panel_width=case_depth-2*acrylic;
side_panel_height=case_height-2*acrylic;
side_panel_teeth=5;
case_teeth_height=acrylic;
case_teeth_width=side_panel_width/(side_panel_teeth*2-1);
// Panels
d_hole_height=27.1;
d_hole_width=23.6;
d_screw_hole_diameter=3.1;
front_panel_height=case_height-2*acrylic;
spacer_hole_diameter=3;
// Parts
d_type_blind_plate_height=31;
d_type_blind_plate_width=26;
h264_encoder_depth=123.19;
h264_encoder_inner_depth=97.5;
h264_encoder_height=23.114;
h264_encoder_width=107.70;
lcd_width=80;
lcd_height=67;
lcd_depth=6;
lcd_mounting_panel_width=93;
lcd_mounting_panel_height=70;
psu_width=125;
psu_height=63;
psu_depth=145;
psu_cutout_width=71;
psu_cutout_depth=84;
ssd_depth=69.85;
ssd_height=9.5;
ssd_width=100;
front_panel_tooth_width= (case_width-lcd_width)/8;
/* Components 2D
------------------------------------------*/
// Case
module laser_surface(){
% square([laser_x,laser_y]);
}
module d_type_hole(){
circle(d=d_hole_width);//d connector hole
translate([9.5,12,0]) circle(d=d_screw_hole_diameter);//upper right screw hole
translate([-9.5,-12,0]) circle(d=d_screw_hole_diameter);//lower left screw hole
}
module case_bolt_hole_2d(){
union(){
translate([(case_nut_max_width-case_bolt_d)/2,0])
square([case_bolt_d,case_bolt_length-acrylic]);
square([case_nut_max_width,case_nut_height*1.1]);
}
}
module case_bolt_hole_centered(){
//center through bolt
translate([-case_nut_max_width/2,0]) case_bolt_hole_2d();
}
module lcd_hole(){
square([lcd_width,lcd_height]);
translate([lcd_width+3.25, lcd_height-4.9]) circle(d=3);//upper right lcd backing panel hole
translate([lcd_width+3.25, 15]) circle(d=3);//lower right lcd backing panel hole
translate([-3.25, lcd_height-4.9]) circle(d=3);//upper left lcd backing panel hole
translate([-3.25, 7.3]) circle(d=3);//lower left lcd backing panel hole
}
module spacer_holes_vga_hdmi_2d(){
circle(d=spacer_hole_diameter);
translate([169,0]) circle(d=spacer_hole_diameter);
translate([0,49]) circle(d=spacer_hole_diameter);
translate([169,49]) circle(d=spacer_hole_diameter);
}
module spacer_holes_vga_splitter_2d(){
circle(d=spacer_hole_diameter);
translate([44,0]) circle(d=spacer_hole_diameter);
translate([44,44]) circle(d=spacer_hole_diameter);
translate([0,44]) circle(d=spacer_hole_diameter);
}
module spacer_holes_bpi_2d(){
circle(d=spacer_hole_diameter);
translate([85.4,0]) circle(d=spacer_hole_diameter);
translate([0,54]) circle(d=spacer_hole_diameter);
translate([85.4,49]) circle(d=spacer_hole_diameter);
}
module spacer_holes_switch_2d(){
circle(d=spacer_hole_diameter);
translate([70,0]) circle(d=spacer_hole_diameter);
}
module spacer_holes_ssd_2d(){
circle(d=spacer_hole_diameter);
translate([76,0]) circle(d=spacer_hole_diameter);
translate([0,62]) circle(d=spacer_hole_diameter);
translate([76,62]) circle(d=spacer_hole_diameter);
}
module d_type_blind_plate_2d(){
module corner(){
difference(){
square([3.5,3.5]);
circle(r=3.5);
}
}
difference(){
square([d_type_blind_plate_width,d_type_blind_plate_height]);
translate([3.5,3.5]) union(){
circle(d=3.5);
rotate([0,0,180]) corner();
};
translate([3.5,d_type_blind_plate_height-3.5]) union(){
circle(d=3.5);
rotate([0,0,90]) corner();
};
translate([d_type_blind_plate_width-3.5,d_type_blind_plate_height-3.5]) union(){
circle(d=3.5);
corner();
}
translate([d_type_blind_plate_width-3.5,3.5]) union(){
circle(d=3.5);
rotate([0,0,270]) corner();
};
}
}
module h264_holder_holes_2d(){
//top spacer holes
translate([-(h264_encoder_width+8)/2,(h264_encoder_inner_depth-8)/2]) circle(d=spacer_hole_diameter);
translate([(h264_encoder_width+8)/2,(h264_encoder_inner_depth-8)/2]) circle(d=spacer_hole_diameter);
translate([(h264_encoder_width+8)/2,-(h264_encoder_inner_depth-8)/2]) circle(d=spacer_hole_diameter);
translate([-(h264_encoder_width+8)/2,-(h264_encoder_inner_depth-8)/2]) circle(d=spacer_hole_diameter);
}
module h264_holder_bottom_2d(){
difference(){
square([h264_encoder_width+16,h264_encoder_inner_depth+16], center=true);
square([h264_encoder_width,h264_encoder_inner_depth], center=true);
h264_holder_holes_2d();
}
}
module h264_holder_top_2d(){
difference(){
square([h264_encoder_width+16,h264_encoder_inner_depth], center=true);
square([h264_encoder_width,h264_encoder_inner_depth-16], center=true);
h264_holder_holes_2d();
}
}
module psu_back_holes_2d(){
//attachment holes for back plate+ venting grille cutouts
translate([psu_width-6.3,6.3]) circle(d=3);
translate([psu_width-6.3,psu_height-6.3]) circle(d=3);
translate([6.3,psu_height/2]) circle(d=3);
//power button and 220v in square
button_hole_width=48;
button_hole_height=24;
translate([psu_width-58-button_hole_width,28]) square([button_hole_width,button_hole_height]);
vent_square_width=44;
vent_square_height=52;
translate([psu_width-12-vent_square_width,7]) square([vent_square_width,vent_square_height]);
}
module frack_panel_2d(){
//// silly name for parent of front and back panel
difference(){
square([case_width,front_panel_height]);
translate([acrylic/2,front_panel_height/8]) circle(d=3);
translate([acrylic/2,front_panel_height*7/8]) circle(d=3);
translate([case_width-acrylic/2,front_panel_height/8]) circle(d=3);
translate([case_width-acrylic/2,front_panel_height*7/8]) circle(d=3);
}
}
module front_panel_tooth_2d(panel){
difference(){
union(){
square([front_panel_tooth_width,acrylic]);
if (panel=="bottom") translate([front_panel_tooth_width/2,2*acrylic]) rotate([180,0,0]) case_bolt_hole_centered();
}
if (panel=="front") translate([front_panel_tooth_width/2,acrylic/2]) circle(d=3);
}
}
module front_panel_teeth_2d(panel){
translate([front_panel_tooth_width,0]) front_panel_tooth_2d(panel);
translate([front_panel_tooth_width*3,0]) front_panel_tooth_2d(panel);
translate([case_width-2*front_panel_tooth_width,0]) front_panel_tooth_2d(panel);
translate([case_width-4*front_panel_tooth_width,0]) front_panel_tooth_2d(panel);
}
module front_panel_2d(){
union(){
difference(){
frack_panel_2d();
translate([d_hole_width+10,(front_panel_height)/2]) d_type_hole();
translate([2*(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([3*(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([4*(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([case_width-(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([case_width-2*(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([case_width-3*(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([case_width-4*(d_hole_width+10),(front_panel_height)/2]) d_type_hole();
translate([(case_width-lcd_width)/2,(front_panel_height-lcd_height)/2]) lcd_hole();
}
translate([0,0.01-acrylic]) front_panel_teeth_2d("front");
translate([0,front_panel_height]) front_panel_teeth_2d("front");
}
}
module front_panel_backing_2d(){
front_panel_backing_hole_height=32;
front_panel_backing_hole_width=135;
union(){
difference(){
frack_panel_2d();
translate([acrylic+10,(front_panel_height-front_panel_backing_hole_height)/2]) square([front_panel_backing_hole_width,front_panel_backing_hole_height]);
translate([case_width-acrylic-10-front_panel_backing_hole_width,(front_panel_height-front_panel_backing_hole_height)/2]) square([front_panel_backing_hole_width,front_panel_backing_hole_height]);
translate([(case_width-lcd_width)/2,(front_panel_height-lcd_height)/2]) lcd_hole();
}
translate([0,0.01-acrylic]) front_panel_teeth_2d("front");
translate([0,front_panel_height]) front_panel_teeth_2d("front");
}
}
module back_panel_2d(){
difference(){
frack_panel_2d();
translate([case_width-acrylic-psu_width,0]) psu_back_holes_2d();
}
}
module toptom_panel_2d(){
//top and bottom panel inherit from this
difference(){
square([case_width, case_depth]);
translate([0,acrylic]) for( i=[0:side_panel_teeth-1]){
rotate([0,0,90]) translate([i*2*case_teeth_width,-case_teeth_height]) square([case_teeth_width,case_teeth_height]);
rotate([0,0,90]) translate([(i*2+3/2)*case_teeth_width,-case_teeth_height/2]) circle(d=3);
}
translate([bottom_panel_width-acrylic,acrylic]) for( i=[0:side_panel_teeth-1]){
rotate([0,0,90]) translate([i*2*case_teeth_width,-case_teeth_height]) square([case_teeth_width,case_teeth_height]);
rotate([0,0,90]) translate([(i*2+3/2)*case_teeth_width,-case_teeth_height/2]) circle(d=3);
}
front_panel_teeth_2d("bottom");
}
}
module bottom_panel_2d(){
difference(){
toptom_panel_2d();
translate([acrylic+8,30]) spacer_holes_vga_hdmi_2d();
translate([acrylic+90,155]) spacer_holes_vga_splitter_2d();
translate([acrylic+217,acrylic+20]) spacer_holes_bpi_2d();
translate([acrylic+340,acrylic+35]) spacer_holes_switch_2d();
translate([acrylic+330,acrylic+79]) spacer_holes_ssd_2d();
translate([acrylic+235,acrylic+185]) h264_holder_holes_2d();
}
}
module top_panel_2d(){
honeycomb_rows=20;
honeycomb_columns=41;
honeycomb_psu_rows=10;
honeycomb_psu_columns=10;
honeycomb_cell_interior=8;
honeycomb_walls=2;
difference(){
toptom_panel_2d();
//translate([case_width-2*acrylic-psu_width/2+5,case_depth-acrylic-psu_depth/2]) circle(d=psu_cutout_width);
translate([case_width-2*acrylic-psu_width+psu_cutout_width/2-8, case_depth-acrylic-psu_depth+psu_cutout_depth/2-7]) honeycomb(honeycomb_psu_rows, honeycomb_psu_columns, honeycomb_cell_interior, honeycomb_walls);
//translate([acrylic+13,acrylic+10]) honeycomb(honeycomb_rows, honeycomb_columns, honeycomb_cell_interior, honeycomb_walls);
translate([30 ,100]) scale([1.9,1.9,1.9]) linear_extrude(height=100, center=true) import(file="/home/lusis/laser_designs/fosdemvideobox/fosdem_logo_and_gear.dxf");
}
}
module side_panel_2d(){
union(){
difference(){
square([side_panel_width,side_panel_height]);
for( i=[0:side_panel_teeth-1]){
translate([case_teeth_width*(2*i+3/2)+case_bolt_d,case_bolt_length-acrylic]) rotate(180,0) case_bolt_hole_2d();
translate([case_teeth_width*(2*i+3/2)-case_bolt_d,side_panel_height-acrylic]) case_bolt_hole_2d();
}
//t slots for front panel
//highest bolt
translate([case_bolt_length-acrylic,front_panel_height/8]) rotate(90,0) case_bolt_hole_centered();
//lowest bolt
translate([case_bolt_length-acrylic,front_panel_height*7/8]) rotate(90,0) case_bolt_hole_centered();
//t slots for back panel
translate([case_depth-case_bolt_length-acrylic,front_panel_height*7/8]) rotate(-90,0) case_bolt_hole_centered();
translate([case_depth-case_bolt_length-acrylic,front_panel_height/8]) rotate(-90,0) case_bolt_hole_centered();
}
//teeth
for( i=[0:side_panel_teeth-1]){
translate([i*2*case_teeth_width,-case_teeth_height]) square([case_teeth_width,case_teeth_height]);
translate([i*2*case_teeth_width,side_panel_height]) square([case_teeth_width,case_teeth_height]);
}
}
}
module left_side_panel_2d(){
translate([0,acrylic]) difference(){
side_panel_2d();
translate([20,20]) honeycomb(5,5,8,2);
}
}
// Panel components 3D
module front_panel(){
linear_extrude(height=acrylic) front_panel_2d();
}
module back_panel(){
linear_extrude(height=acrylic) back_panel_2d();
}
module top_panel(){
linear_extrude(height=acrylic) top_panel_2d();
}
module bottom_panel(){
% linear_extrude(height=acrylic) bottom_panel_2d();
}
module side_panel(){
linear_extrude(height=acrylic) side_panel_2d();
}
module d_type_blind_plate(label){
linear_extrude(height=3) d_type_blind_plate_2d();
translate([d_type_blind_plate_width/2, d_type_blind_plate_height/2, 3])
color("red") {
text(size=4,halign="center", valign="center", text=label);
}
}
module honeycomb(rows, columns, cell_interior, walls) {
for (i = [0 : rows - 1]) {
for (j = [0 : (columns - 1 - i%2)]) {
translate([(j + (i % 2) /2) * (cell_interior + walls),
(cell_interior + walls) * i * sqrt(3) / 2])
rotate([0,0,30])
difference() {
//circle(r=(cell_interior + 2 * walls)/sqrt(3),$fn=6); //comment out to get inverse
circle(r=cell_interior/sqrt(3),$fn=6);
}
}
}
}
//3 bottom panels, 6 back panels, 1 right side panel
module parts_plate_1(){
bottom_panel_2d();
translate([case_width+0.01,0]) bottom_panel_2d();
translate([0,case_depth+0.01]) back_panel_2d();
translate([0,case_depth+front_panel_height+0.02]) back_panel_2d();
translate([0,case_depth+2*front_panel_height+0.03]) back_panel_2d();
translate([case_width+0.01,case_depth+0.01]) back_panel_2d();
translate([case_width+0.01,case_depth+front_panel_height+0.02]) back_panel_2d();
translate([case_width+0.01,case_depth+2*front_panel_height+0.03]) back_panel_2d();
translate([2*case_width+case_depth+0.02,0]) rotate([0,0,90]) bottom_panel_2d();
translate([2*case_width+0.1,case_width+acrylic+0.01]) side_panel_2d();
}
3d=0;
if(3d){
generate_3d();
}
else {
translate([0,acrylic]) front_panel_2d();
translate([0,acrylic+case_height+0.01]) front_panel_backing_2d();
//generate_2d();
}
// Case parts in 2d for laser cutting
module generate_2d(){
laser_surface();
bottom_panel_2d();
color("blue") translate([0,case_depth]) top_panel_2d();
color("red") translate([case_width,0]) back_panel_2d();
color("green") translate([case_width,front_panel_height]) front_panel_2d();
color("orange") translate([case_width,2*front_panel_height]) side_panel_2d();
color("purple") translate([case_width,3*front_panel_height]) side_panel_2d();
translate([case_width,4*front_panel_height]) d_type_blind_plate_2d();
}
// Case in 3d
module generate_3d(){
//translate([-case_width/2, -case_depth/2, 0]) {
//Panels
% bottom_panel();
% translate([0,0,case_height-acrylic])
top_panel();
% translate([0,acrylic,acrylic])
rotate([90,0,0])
front_panel();
% translate([0,case_depth,acrylic])
rotate([90,0,0])
back_panel();
% translate([0,acrylic,acrylic])
rotate([90,0,90])
side_panel();
% translate([case_width-acrylic,acrylic,acrylic])
rotate([90,0,90])
side_panel();
// left side d type panel mount coupler plates
translate([d_hole_width/2-(d_type_blind_plate_width-d_hole_width)/2+10,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("spare");
translate([d_hole_width*3/2-(d_type_blind_plate_width-d_hole_width)/2+20,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("spare");
translate([d_hole_width*5/2-(d_type_blind_plate_width-d_hole_width)/2+30,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("spare");
translate([d_hole_width*7/2-(d_type_blind_plate_width-d_hole_width)/2+40,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("spare");
//right side d type panel mount coupler plates
translate([case_width-d_hole_width*3/2-(d_type_blind_plate_width-d_hole_width)/2-10,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("ethernet 3");
translate([case_width-d_hole_width*5/2-(d_type_blind_plate_width-d_hole_width)/2-20,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("ethernet 2");
translate([case_width-d_hole_width*7/2-(d_type_blind_plate_width-d_hole_width)/2-30,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("ethernet 1");
translate([case_width-d_hole_width*9/2-(d_type_blind_plate_width-d_hole_width)/2-40,0,acrylic+(front_panel_height-d_type_blind_plate_height)/2])
rotate([90,0,0])
d_type_blind_plate("camera in");
}
//}