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