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 // calculated
15
16 top_z = max( phone[2] + wall[2],
17              phone_button_z + minwall )
18   + phone_slop[2];
19
20 module MainProfileInnerHalf(){
21   p = phone + phone_slop;
22   pb = phone_button_z + phone_slop[2];
23   polygon([[ -2,                 0    ],
24            [ p[1]/2,             0    ],
25            [ p[1]/2,             p[2] ],
26            [ button_dy_outer/2,  p[2] ],
27            [ button_dy_outer/2,  pb   ],
28            [ button_dy_inner/2,  pb   ],
29            [ button_dy_inner/2,  p[2] ],
30            [ button_dy_centre/2, p[2] ],
31            [ button_dy_centre/2, pb   ],
32            [ -2,                 pb   ]]);
33 }
34
35 module MainProfile(){
36   p = phone + phone_slop;
37   for (m=[0,1]) mirror([m,0]) {
38       difference(){
39         translate([-1, -wall[2] ])
40           square([ p[1]/2 + wall[1] + 1, top_z + wall[2] ]);
41         MainProfileInnerHalf();
42       }
43     }
44 }
45
46 module Box(){
47   mirror([0,1,0]) rotate([90,0,0]) {
48     linear_extrude(height = phone[0] + wall[0])
49       MainProfile();
50     translate([0,0, phone[0]])
51       linear_extrude(height = wall[0])
52       hull() MainProfile();
53   }
54 }
55
56 //MainProfileInner();
57 Box();