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