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