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