chiark / gitweb /
52baafacebe76aaf700534fca1df2d035ec0e909
[reprap-play.git] / flyscreen-handle.scad
1 // -*- C -*-
2
3 opening_height = 7.84;
4 opening_depth = 7.88;
5 openingedge_dia = 2.00;
6 opening_protrh = 2.00;
7
8 pivot_x = 6;
9 inside_len = 4;
10
11 pivoting_gap = 0.1;
12
13 outside_gap = 3;
14 outside_len = 16;
15 outend_height = 3;
16
17 outside_pushh = 4;
18 outside_pushslope = 1.4;
19 outside_push_inadj = 0.82;
20
21 ourcirc_r = 0.5 / 2;
22
23 ribble_dia = 2.2;;
24
25 opening_protr_slop = 0.1;
26
27 intooth_top_slop = 0.1;
28 inside_h_xgap = 1;
29
30 pivot_r = 2;
31 pivot_slop = 0.25;
32
33 strap_above = 0.1;
34 strap_th = 2.5;
35 strap_below = 3;
36
37 width = 5;
38
39 // calculated
40
41 inside_h = opening_height/2 - opening_protrh - inside_h_xgap/2;
42
43 edge_or = openingedge_dia/2 + opening_protr_slop;
44
45 Q0 = [ openingedge_dia/2,
46        openingedge_dia/2 + opening_height/2 ];
47
48 p4p5d = [edge_or + ourcirc_r, 0];
49
50 P0 = [ pivot_x, pivoting_gap ];
51 P4 = Q0 - p4p5d;
52 P3t = [ P4[0], Q0[1] - openingedge_dia/2 + opening_protrh
53         - intooth_top_slop - ourcirc_r ];
54 P2 = P4 + [ -(inside_len - ourcirc_r*2), 0 ];
55 P1 = [ P2[0], P3t[1] - (inside_h + ourcirc_r*2) ];
56
57 P5 = Q0 + p4p5d;
58
59 P8t = [ outside_len - ourcirc_r, P5[1] ];
60 P9t = P8t + [ 0, -(strap_above + strap_th + strap_below - ourcirc_r*2) ];
61
62 P9b = [ P9t[0], -P9t[1] + outside_gap ];
63 P8b = P9b + [ 0, outend_height ];
64
65 P6t = P5 + [ 0, outside_pushh - ourcirc_r*2 ];
66 P7 = [ P6t[0] + (P6t[1] - P1[1]) / outside_pushslope,
67        P1[1] ];
68
69 P3a = P3t + [ -outside_push_inadj, 0 ];
70 P6a = P6t + [ -outside_push_inadj, 0 ];
71
72 outside_push_inadj_slope = (P3t[1]-P4[1]) / (P6a[1]-P5[1]);
73
74 ribble_rad = ribble_dia/2;
75
76 module ExtrusionSect(){
77   cr = openingedge_dia/2;
78   toph = opening_height/2 + opening_protrh;
79
80   for (my=[0,1]) {
81     mirror([0,my]) {
82       translate(Q0) {
83         hull(){
84           circle(r=cr, $fn=20);
85           translate([-cr,10]) square([cr*2, 1]);
86         }
87       }
88     }
89   }
90   translate([-opening_depth, -toph]) {
91     difference(){
92       translate([-5,-5])
93         square([opening_depth+6, toph*2+10]);
94       square([opening_depth+2, toph*2]);
95     }
96   }
97 }
98
99 module PsHull(ps) {
100   hull(){
101     for (p = ps) {
102       translate(p)
103         circle(r = ourcirc_r, $fn=10);
104     }
105   }
106 }
107
108 module LeverSect(top, inadj=false){
109   P3 = inadj ? P3a : P3t;
110   P6 = inadj ? P6a : P6t;
111   P8 = top ? P8t : P8b;
112   P9 = top ? P9t : P9b;
113   difference(){
114     union(){
115       PsHull([P2,P3,P4]);
116       PsHull([P0,P1,P2,P5,P8,P9]);
117     }
118     hull(){
119       for (dp = [ [0,0],
120                   (P6-P5),
121                   (P3-P4)
122                   ]) {
123         translate(Q0 + 5*dp) circle(r=edge_or, $fn=20);
124       }
125     }
126   }
127 }
128
129 module StrapSectTop(){
130   translate(P9t + ourcirc_r * [+1,-1]) {
131     difference(){
132       circle(r = strap_below + strap_th, $fn=40);
133       circle(r = strap_below,            $fn=40);
134     }
135   }
136 }
137
138 module StrapSectBot(){
139   mirror([0,1]){
140     translate(P9b + [ ourcirc_r - (strap_below + strap_th), -10 ]) {
141       square([strap_th, 20]);
142     }
143   }
144 }
145
146 module LeverSectTop(){
147   difference(){
148     union(){
149       LeverSect(true, false);
150       for (x = [ P8t[0] + ourcirc_r - ribble_rad :
151                  -ribble_rad * 4 :
152                  Q0[0] + edge_or + ribble_rad*2 ]) {
153         translate([x, P5[1] + ourcirc_r])
154           circle(r = ribble_rad, $fn=20);
155       }
156     }
157     translate([pivot_x,0]) circle(r= pivot_r + pivot_slop, $fn=20);
158   }
159 }
160
161 module LeverSectBot(inadj=false){
162   P6 = inadj ? P6a : P6t;
163   mirror([0,1]) {
164     LeverSect(false, inadj);
165     PsHull([P5,P6,P7]);
166     translate([pivot_x,0]) circle(r=pivot_r, $fn=20);
167   }
168 }
169
170 module Demo(){
171   translate([0,0,-5]) color("white") ExtrusionSect();
172   LeverSectTop();
173   translate([0,0,5]) LeverSectBot();
174   color("black") LeverSectBot(true);
175   color("blue") translate([0,0,10]) StrapSectTop();
176   color("purple") translate([0,0,10]) StrapSectBot();
177 }
178
179 module LeverTop(){
180   linear_extrude(height=width, convexity=100) LeverSectTop();
181 }
182
183 module LeverBot(inadj=false){
184   linear_extrude(height=width, convexity=100) LeverSectBot(inadj);
185 }
186
187 module Test(){
188   translate([0,2,0]) LeverTop();
189   LeverBot();
190   translate([0,-opening_height - 2,0]) LeverBot(true);
191 }
192
193 //LeverSectBot(true);
194 Demo();
195 //Test();