]> mj.ucw.cz Git - home-hw.git/blob - rainbow/case/case.scad
FIXME'd
[home-hw.git] / rainbow / case / case.scad
1 wall_thickness = 1.5;
2
3 pcb_length = 53;
4 pcb_width = 23;
5 pcb_thickness = 1.6;
6 pcb_depth = 2;
7 pcb_rail_width = 1.5;
8 pcb_prog_stick_out = 5;         // how much does the programming connector stick out
9
10 box_height = 12;
11 box_depth = pcb_thickness + pcb_depth;
12
13 lid_rail_width = 1;
14 lid_rail_height = 2;
15
16 usb_width = 10;
17 usb_height = 4;
18
19 rs485_width = 16.5;
20 rs485_height = 8;
21
22 over = 0.1;
23 clearance = 0.2;
24
25 module bottom() {
26         difference() {
27                 // Exterior
28                 translate([-wall_thickness, -wall_thickness, -box_depth-wall_thickness])
29                         cube([2*wall_thickness + pcb_length + pcb_prog_stick_out, 2*wall_thickness + pcb_width, wall_thickness + box_depth + box_height]);
30
31                 // Interior
32                 cube([pcb_length + pcb_prog_stick_out, pcb_width, box_height+1]);
33
34                 // USB connector hole
35                 translate([-wall_thickness-over, (pcb_width-usb_width)/2, -pcb_thickness])
36                         cube([wall_thickness+2*over, usb_width, pcb_thickness+box_height+over]);
37
38                 // PCB
39                 translate([0, 0, -pcb_thickness])
40                         cube([pcb_length, pcb_width, pcb_thickness+over]);
41
42                 // Sub-PCB hole
43                 translate([0, pcb_rail_width, -pcb_thickness-pcb_depth])
44                         cube([pcb_length, pcb_width - 2*pcb_rail_width, pcb_thickness + pcb_depth + over]);
45         }
46 }
47
48 module top() {
49         difference() {
50                 union() {
51                         // Lid
52                         translate([-wall_thickness, -wall_thickness, 0])
53                                 cube([pcb_length + pcb_prog_stick_out + 2*wall_thickness, pcb_width + 2*wall_thickness, wall_thickness]);
54
55                         // Rails
56                         translate([0, 0, -lid_rail_height])
57                                 cube([pcb_length + pcb_prog_stick_out, lid_rail_width, lid_rail_height + over]);
58                         translate([0, pcb_width - lid_rail_width, -lid_rail_height])
59                                 cube([pcb_length + pcb_prog_stick_out, lid_rail_width, lid_rail_height + over]);
60
61                         // USB connector roof
62                         translate([-wall_thickness, (pcb_width - usb_width)/2 + clearance, usb_height - box_height + clearance])
63                                 cube([wall_thickness, usb_width - 2*clearance, box_height - usb_height - clearance + over]);
64
65                         // RS485 connector roof
66                         //translate([-wall_thickness, (pcb_width - rs485_width)/2 + clearance, rs485_height - box_height + clearance])
67                         //      cube([wall_thickness, rs485_width - 2*clearance, box_height - rs485_height - clearance + over]);
68                 }
69         }
70 }
71
72 //bottom();
73 color([1, 0, 0]) translate([0, 0, box_height]) top();