chiark / gitweb /
laptop-sound-cable-hooks: wip
[reprap-play.git] / laptop-sound-cable-hooks.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 wall_th = 2;
6 hook_th = 4;
7 hook_hole = 4;
8
9 plug_l_d = [[ 27.78,
10               10.62 + 0.50 ],
11             [ 40.88,
12               8.56 + 0.50 ],
13             ];
14
15 plug_stem = [ 2.72 + 0.50,
16               5.20 + 0.50 ];
17
18 palmrest_from_plug_z = 3.98;
19 laptop_th = 16.31 + 0.75;
20
21 tongue_len = 50;
22
23 // calculated
24
25
26 hook_th_plug_holder =
27   plug_l_d[0][1]/2 + wall_th * sin(22.5);
28
29 hook_tongue_h = hook_hole + wall_th*2;
30
31 plug_hook_z_laptop_base = palmrest_from_plug_z - laptop_th;
32 plug_hook_z_min = palmrest_from_plug_z - hook_tongue_h;
33 plug_hook_x_min = -plug_l_d[len(plug_l_d)-1][0] - wall_th;
34
35 module PlugMainPlan() {
36   for (l_d = plug_l_d) {
37     l = l_d[0];
38     d = l_d[1];
39     rectfromto([ -l, -d/2 ],
40                [  0, +d/2 ]);
41   }
42 }
43
44 module PlugHolderPlan() {
45   intersection(){
46     hull()
47       offset(r= wall_th)
48       PlugMainPlan();
49
50     rectfromto([-100,-100], [-0.1,+100]);
51   }
52 }
53
54 module PlugHookHookPlan(){
55   polygon([ [ plug_hook_x_min, 0 ],
56             [ plug_hook_x_min + -plug_hook_z_min, plug_hook_z_min ],
57             [ tongue_len, plug_hook_z_min ],
58             [ tongue_len, plug_hook_z_laptop_base ],
59             [ 0, plug_hook_z_laptop_base ],
60             [ 0, 0 ],
61             ]);
62 }
63
64 module RotateIntersect(n=6){
65   intersection_for (r = [0:n-1]) {
66     rotate([r/n * 360,0,0])
67       linextr(-100,100) children(0);
68   }
69 }
70
71 module PlugHolder(){
72   difference(){
73     union(){
74       RotateIntersect(8)
75         PlugHolderPlan();
76
77       linextr_y_xz(-hook_th_plug_holder,
78                    +hook_th_plug_holder)
79         PlugHookHookPlan();
80     }
81
82     RotateIntersect(6)
83       PlugMainPlan();
84
85     linextr(-plug_stem[1]/2, 100)
86       rectfromto([ -100, -plug_stem[0]/2 ],
87                  [ +100, +plug_stem[0]/2 ]);
88   }
89 }
90
91 module DemoPlan() {
92   translate([0,0,-5]) color("grey") PlugHolderPlan();
93   PlugMainPlan();
94 }
95
96 //DemoPlan();
97 PlugHookHookPlan();
98 //render() PlugHolder();