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