chiark / gitweb /
36205f12748edf86e6ab7bf10fd148f55ba3fdc2
[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 = 13;
15 outend_height = 3;
16
17 outside_len_bot = 23;
18
19 outside_pushh = 4;
20 outside_pushslope = 1.4;
21 outside_push_inadj = 0.82;
22
23 ourcirc_r = 0.5 / 2;
24
25 ribble_dia = 2.2;;
26
27 opening_protr_slop = 0.1;
28
29 intooth_top_slop = 0.1;
30 inside_h_xgap = 1;
31
32 pivot_r = 2;
33 pivot_slop = 0.25;
34
35 strap_above = 0.1;
36 strap_th = 2.5;
37 strap_below = 3;
38 strap_width = 5;
39
40 width = 35;
41 nstraps = 2;
42
43 test_width = 5;
44
45 // calculated
46
47 inside_h = opening_height/2 - opening_protrh - inside_h_xgap/2;
48
49 edge_or = openingedge_dia/2 + opening_protr_slop;
50
51 Q0 = [ openingedge_dia/2,
52        openingedge_dia/2 + opening_height/2 ];
53
54 p4p5d = [edge_or + ourcirc_r, 0];
55
56 P0 = [ pivot_x, pivoting_gap ];
57 P4 = Q0 - p4p5d;
58 P3t = [ P4[0], Q0[1] - openingedge_dia/2 + opening_protrh
59         - intooth_top_slop - ourcirc_r ];
60 P2 = P4 + [ -(inside_len - ourcirc_r*2), 0 ];
61 P1 = [ P2[0], P3t[1] - (inside_h + ourcirc_r*2) ];
62
63 P5 = Q0 + p4p5d;
64
65 P8t = [ outside_len - ourcirc_r, P5[1] ];
66 P9t = P8t + [ 0, -(strap_above + strap_th + strap_below - ourcirc_r*2) ];
67
68 P9b = [ P9t[0], -P9t[1] + outside_gap ];
69 P8b = P9b + [ 0, outend_height ];
70
71 P89eadj = [ outside_len_bot - outside_len, 0 ];
72 P8eb = P8b + P89eadj;
73 P9eb = P9b + P89eadj;
74
75 P6t = P5 + [ 0, outside_pushh - ourcirc_r*2 ];
76 P7 = [ P6t[0] + (P6t[1] - P1[1]) / outside_pushslope,
77        P1[1] ];
78
79 P3a = P3t + [ -outside_push_inadj, 0 ];
80 P6a = P6t + [ -outside_push_inadj, 0 ];
81
82 outside_push_inadj_slope = (P3t[1]-P4[1]) / (P6a[1]-P5[1]);
83
84 ribble_rad = ribble_dia/2;
85
86 kit_adj_shift = -opening_height - 2.0;
87
88 module ExtrusionSect(){
89   cr = openingedge_dia/2;
90   toph = opening_height/2 + opening_protrh;
91
92   for (my=[0,1]) {
93     mirror([0,my]) {
94       translate(Q0) {
95         hull(){
96           circle(r=cr, $fn=20);
97           translate([-cr,10]) square([cr*2, 1]);
98         }
99       }
100     }
101   }
102   translate([-opening_depth, -toph]) {
103     difference(){
104       translate([-5,-5])
105         square([opening_depth+6, toph*2+10]);
106       square([opening_depth+2, toph*2]);
107     }
108   }
109 }
110
111 module PsHull(ps) {
112   hull(){
113     for (p = ps) {
114       translate(p)
115         circle(r = ourcirc_r, $fn=10);
116     }
117   }
118 }
119
120 module LeverSect(top, inadj=false){
121   P3 = inadj ? P3a : P3t;
122   P6 = inadj ? P6a : P6t;
123   P8 = top ? P8t : P8b;
124   P9 = top ? P9t : P9b;
125   difference(){
126     union(){
127       PsHull([P2,P3,P4]);
128       PsHull([P0,P1,P2,P5,P8,P9]);
129     }
130     hull(){
131       for (dp = [ [0,0],
132                   (P6-P5),
133                   (P3-P4)
134                   ]) {
135         translate(Q0 + 5*dp) circle(r=edge_or, $fn=20);
136       }
137     }
138   }
139 }
140
141 module StrapSectTop(){
142   translate(P9t + ourcirc_r * [+1,-1]) {
143     difference(){
144       circle(r = strap_below + strap_th, $fn=40);
145       circle(r = strap_below,            $fn=40);
146     }
147   }
148 }
149
150 module StrapSectBot(){
151   mirror([0,1]){
152     for (dx = [ -(strap_below + strap_th),
153                 0 ]) {
154       translate(P9b + [ ourcirc_r + dx, -10 ]) {
155         square([strap_th, 20]);
156       }
157     }
158   }
159 }
160
161 module LeverSectTop(){
162   difference(){
163     union(){
164       LeverSect(true, false);
165       for (x = [ P8t[0] + ourcirc_r - ribble_rad :
166                  -ribble_rad * 4 :
167                  Q0[0] + edge_or + ribble_rad*2 ]) {
168         translate([x, P5[1] + ourcirc_r])
169           circle(r = ribble_rad, $fn=20);
170       }
171     }
172     translate([pivot_x,0]) circle(r= pivot_r + pivot_slop, $fn=20);
173   }
174 }
175
176 module LeverSectBot(inadj=false){
177   P6 = inadj ? P6a : P6t;
178   mirror([0,1]) {
179     LeverSect(false, inadj);
180     PsHull([P5,P6,P7]);
181     PsHull([P8b,P8eb,P9eb,P9b]);
182     translate([pivot_x,0]) circle(r=pivot_r, $fn=20);
183   }
184 }
185
186 module Demo(){
187   translate([0,0,-5]) color("white") ExtrusionSect();
188   LeverSectTop();
189   translate([0,0,5]) LeverSectBot();
190   color("black") LeverSectBot(true);
191   color("blue") translate([0,0,10]) StrapSectTop();
192   color("purple") translate([0,0,-10]) StrapSectBot();
193 }
194
195 module SomeLever() {
196   // SomeLever(){ LeverBot(inadj); LeverSectBot(); }
197   difference(){
198     linear_extrude(height=width, convexity=100) children(0);
199     for (i = [ 0 : nstraps - 1 ]) {
200       translate([0,0, (i + 0.5) / nstraps * width - strap_width/2])
201         linear_extrude(height=strap_width, convexity=10)
202         children(1);
203     }
204   }
205 }
206
207 module Test(){
208   linear_extrude(height=test_width, convexity=100) {
209     translate([0,2,0]) LeverSectTop();
210     LeverSectBot();
211     translate([0,kit_adj_shift]) LeverSectBot(true);
212   }
213 }
214
215 module LeverTop(){ ////toplevel
216   SomeLever(){
217     LeverSectTop();
218     StrapSectTop();
219   }
220 }
221 module LeverBot(){ ////toplevel
222   SomeLever(){
223     LeverSectBot();
224     StrapSectBot();
225   }
226 }
227 module LeverBotAdj(){ ////toplevel
228   SomeLever(){
229     LeverSectBot(true);
230     StrapSectBot(true);
231   }
232 }
233
234 module Kit(){ ////toplevel
235   translate([0,2,0]) LeverTop();
236   LeverBot();
237 }
238
239 module KitAdj(){ ////toplevel
240   translate([0,2,0]) LeverTop();
241   LeverBotAdj();
242 }
243
244 //LeverSectBot(true);
245 //Demo();
246 //LeverTop();
247 //Test();
248 //Kit();
249 //KitAdj();