chiark / gitweb /
flyscreen-handle: tapered peg section
[reprap-play.git] / flyscreen-handle.scad
1 // -*- C -*-
2
3 opening_height = 7.84 - 0.3 + 0.60;
4 opening_depth = 6.0; // 7.88;
5 openingcnr_dia = 2.75;
6 opening_topprotr = 1.54;
7
8 gap = 0.25;
9
10 retain_rad = 1.65;
11 retain_protr = 0.35;
12 retain_hgap_adjust = 1.5;
13
14 retain_stalk_len = 8.0;
15 retain_stalk_h = 1.5;
16 retain_bend_gap = 2.0;
17 retain_empir_angle = -10;
18 retain_pushmore_adj = 0.0;
19
20 hgap_empir_adjust = -0.5 -2.50;
21
22 topprotr_rad = 0.35;
23
24 bot_overlap = 4;
25 bot_w = 3;
26
27 handle_w = 10;
28 handle_rh = 3;
29 handle_rcut = 3;
30
31 cutout_gap = 1.5;
32
33 total_len = 40;
34 retain_len = 8;
35 basics_len = 8;
36
37 overret_hch = 5;
38
39 peg_width_slop = 0.5;
40 peg_inner_thick = 1.0;
41
42 // calculated
43
44 ins_irad = openingcnr_dia/2 + gap;
45 ins_orad = openingcnr_dia/2 + opening_height - gap;
46 ins_th = ins_orad - ins_irad;
47
48 handle_x0 = ins_irad + hgap_empir_adjust;
49 handle_h = bot_overlap + ins_th;
50 handle_y0 = -ins_orad-bot_overlap;
51 handle_y1 = handle_y0 + handle_h;
52
53 handle_x1 = handle_x0 + bot_w + handle_w;
54
55 topprotr_y = -ins_irad + opening_topprotr;
56
57 retain_mxy = [handle_x0 - retain_rad - retain_hgap_adjust,
58               -ins_orad + retain_rad - retain_protr];
59
60 retain_cutout_h = retain_rad * 2 + retain_bend_gap;
61
62 overret_gaplen = retain_cutout_h / cos(retain_empir_angle);
63
64 peg_width = retain_stalk_len -
65   (handle_x0 - retain_mxy[0]) / cos(retain_empir_angle)
66   - peg_width_slop;
67
68 peg_height = retain_cutout_h - (retain_rad + retain_stalk_h)
69   + retain_pushmore_adj;
70
71 retain1_len = retain_len + retain_stalk_len;
72 retain1_base = total_len - retain1_len;
73
74 module InsertSection(){
75   hull(){
76     translate([-ins_irad, -ins_irad])
77       mirror([1, 0])
78       square([opening_depth - ins_irad, 0.1]);
79     translate([-ins_irad - topprotr_rad,
80                topprotr_y - topprotr_rad])
81       circle(r=topprotr_rad, $fn=10);
82   }
83   translate([0, -ins_orad]) square([ins_irad+1, ins_th]);
84   intersection(){
85     translate([0, -ins_irad])
86       mirror([1,1])
87       square([100, opening_depth]);
88     difference(){
89       circle(r= ins_orad);
90       circle(r= ins_irad, $fn=20);
91     }
92   }
93 }
94
95 module HandleSection(){
96   difference(){
97     hull(){
98       translate([handle_x0, handle_y0])
99         square([bot_w, handle_h]);
100       for (y= [handle_y1 - handle_rh/2,
101                handle_y1 - ins_th + handle_rh/2]) {
102         translate([handle_x1 - handle_rh/2, y])
103           circle(r= handle_rh/2, $fn=20);
104       }
105     }
106     hull(){
107       for (x= [handle_x0 + bot_w + handle_rcut/2,
108                handle_x1 - handle_rh/2 - handle_rcut/2]) {
109         translate([x, handle_y1])
110           circle(r = handle_rcut/2, $fn=20);
111       }
112     }
113   }
114   hull(){
115     for (y= [handle_y1 -   handle_rh/2,
116              handle_y1 - 3*handle_rh/2])
117       translate([handle_x1 - handle_rh/2, y])
118         circle(r = handle_rh/2, $fn=20);
119   }
120   translate([ handle_x1 - handle_rh*2,
121               handle_y1 - handle_rh/2 ])
122     circle(r = handle_rh/2, $fn=20);
123 }
124
125 module RetainSection(){
126   translate(retain_mxy) {
127     rotate(retain_empir_angle) {
128       circle(r=retain_rad, $fn=20);
129       translate([0, -retain_pushmore_adj])
130         square([retain_stalk_len + 1, retain_stalk_h]);
131     }
132   }
133 }
134
135 module PegSection(delta){
136   hull(){
137     square([0.1,
138             peg_height + delta]);
139     translate([peg_width - 0.1,
140                peg_height/2 - peg_inner_thick/2])
141       square([0.1, peg_inner_thick]);
142   }
143 }
144
145 module PegSectionForDemo(delta){
146   translate(retain_mxy)
147     rotate(retain_empir_angle)
148     translate([retain_stalk_len - peg_width - peg_width_slop/2,
149                retain_stalk_h - retain_pushmore_adj])
150     PegSection(delta);
151 }
152
153 module RetainCutout(gapping=false){
154   translate(retain_mxy) {
155     rotate(retain_empir_angle) {
156       translate([-50, -retain_rad]) {
157         square([50 + retain_stalk_len,
158                 retain_cutout_h]);
159       }
160     }
161   }
162 }  
163
164 module GappingSection(){
165   difference(){
166     union(){
167       InsertSection();
168       HandleSection();
169     }
170     RetainCutout(true);
171   }
172 }
173
174 module WithRetainSection(){
175   difference(){
176     union(){
177       InsertSection();
178       HandleSection();
179     }
180     RetainCutout();
181   }
182   RetainSection();
183 }
184
185 module BasicSection(){
186   InsertSection();
187   HandleSection();
188 }
189
190 module Handle(){
191   bs1 = retain_len + overret_gaplen + 4;
192
193   translate([0,0,0])
194     linear_extrude(height= retain_len)
195     WithRetainSection();
196
197   translate([0,0, bs1])
198     linear_extrude(height= basics_len)
199     BasicSection();
200
201   translate([0,0, bs1+0.1]) mirror([0,0,1]) {
202     intersection_for (sl=[0,1]) {
203       multmatrix([[1,0,0,0],
204                   [0,1,sl,0],
205                   [0,0,1,0],
206                   [0,0,0,1]])
207         linear_extrude(height= overret_gaplen + 10, convexity=100)
208         BasicSection();
209     }
210   }
211   
212   linear_extrude(height=total_len, convexity=100) GappingSection();
213
214   translate([0,0, retain1_base]) {
215     intersection(){
216       linear_extrude(height=retain1_len, convexity=100)
217         WithRetainSection();
218       translate([retain_mxy[0], retain_mxy[1], 0])
219         rotate([0,0, retain_empir_angle])
220         translate([retain_stalk_len, -30, 0])
221         multmatrix([[1,0,-1,0],
222                     [0,1,0,0],
223                     [0,0,1,0],
224                     [0,0,0,1]])
225         cube([50, 60, 50]);
226     }
227   }
228 }
229
230 module Demo(){
231   color("red") translate([0,0,-3]) BasicSection();
232   color("blue") translate([0,0,3]) WithRetainSection();
233   color("orange") translate([0,0,7]) PegSectionForDemo(0);
234 }
235
236 module Test(){
237   linear_extrude(height=2) {
238     WithRetainSection();
239     translate([0, -handle_y0 + topprotr_y + 10])
240       BasicSection();
241   }
242 }
243
244 Demo();
245 //HandleSection();
246 //InsertSection();
247 //WithRetainSection();
248 //BasicSection();
249 //GappingSection();
250 //Test();
251 //Demo();
252 //Handle();