chiark / gitweb /
sleepphone-cable-box: wip
[reprap-play.git] / sleepphone-cable-box.scad
1 // -*- C -*-
2
3 wall = 0.75 * [1,1,1];
4 phone = [ 76.40, 30.96, 6.26 ];
5 phone_button_z = 6.58;
6 minwall = 0.25;
7
8 button_dy_outer = 28.42;
9 button_dy_inner = 19.05;
10 button_dy_centre = 5.65;
11
12 phone_slop = [1,1,1] * 0.5;
13
14 led = [25.9, 9.44]; // y is from edge
15 led_dia = 4.4;
16
17 // calculated
18
19 top_z = max( phone[2] + wall[2],
20              phone_button_z + minwall )
21   + phone_slop[2];
22
23 module MainProfileInnerHalf(){
24   p = phone + phone_slop;
25   pb = phone_button_z + phone_slop[2];
26   polygon([[ -2,                 0    ],
27            [ p[1]/2,             0    ],
28            [ p[1]/2,             p[2] ],
29            [ button_dy_outer/2,  p[2] ],
30            [ button_dy_outer/2,  pb   ],
31            [ button_dy_inner/2,  pb   ],
32            [ button_dy_inner/2,  p[2] ],
33            [ button_dy_centre/2, p[2] ],
34            [ button_dy_centre/2, pb   ],
35            [ -2,                 pb   ]]);
36 }
37
38 module MainProfile(){
39   p = phone + phone_slop;
40   for (m=[0,1]) mirror([m,0]) {
41       difference(){
42         translate([-1, -wall[2] ])
43           square([ p[1]/2 + wall[1] + 1, top_z + wall[2] ]);
44         MainProfileInnerHalf();
45       }
46     }
47 }
48
49 module BoxMain(){
50   rotate([0,0,90]) rotate([90,0,0]) {
51     linear_extrude(height = phone[0] + wall[0], convexity=20)
52       MainProfile();
53     translate([0,0, phone[0]])
54       linear_extrude(height = wall[0], convexity=20)
55       hull() MainProfile();
56   }
57 }
58
59 module Box(){
60   difference(){
61     BoxMain();
62
63     translate([ led[0], phone[1]/2 - led[1], 1 ])
64       cylinder(r = led_dia/2, h= phone[2]*2, $fn=20);
65   }
66 }
67
68 //MainProfileInner();
69 Box();