chiark / gitweb /
88924c9708a75525991d97c9af92bb7f1c0b8b9c
[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 = 6.5;
15 retain_stalk_h = 1.5;
16 retain_bend_gap = 2.0;
17 retain_empir_angle = -25;
18 retain_pushmore_adj = 0.75;
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 - retain_pushmore_adj];
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       square([retain_stalk_len + 1, retain_stalk_h]);
119     }
120   }
121 }
122
123 module RetainCutout(gapping=false){
124   translate(retain_mxy) {
125     rotate(retain_empir_angle) {
126       translate([-50, -retain_rad]) {
127         square([50 + retain_stalk_len,
128                 retain_cutout_h]);
129       }
130     }
131   }
132 }  
133
134 module GappingSection(){
135   difference(){
136     union(){
137       InsertSection();
138       HandleSection();
139     }
140     RetainCutout(true);
141   }
142 }
143
144 module WithRetainSection(){
145   difference(){
146     union(){
147       InsertSection();
148       HandleSection();
149     }
150     RetainCutout();
151   }
152   RetainSection();
153 }
154
155 module BasicSection(){
156   InsertSection();
157   HandleSection();
158 }
159
160 module Handle(){
161   bs0 = retaining_len + overret_gaplen + basics_len;
162   bs1 = bs0 + overret_hch;
163   linear_extrude(height=total_len, convexity=100) GappingSection();
164
165   translate([0,0, basics_len]) {
166     intersection(){
167       linear_extrude(height=retaining_len, convexity=100)
168         WithRetainSection();
169       translate([retain_mxy[0], retain_mxy[1], 0])
170         rotate([0,0, retain_empir_angle])
171         translate([retain_stalk_len, -30, 0])
172         multmatrix([[1,0,-1,0],
173                     [0,1,0,0],
174                     [0,0,1,0],
175                     [0,0,0,1]])
176         cube([50, 60, 50]);
177     }
178   }
179
180   for (z= [0, bs1]) {
181     translate([0,0, z])
182       linear_extrude(height= basics_len)
183       BasicSection();
184   }
185
186   translate([0,0, bs1+0.1]) mirror([0,0,1]) {
187     intersection_for (sl=[0,1]) {
188       multmatrix([[1,0,0,0],
189                   [0,1,sl,0],
190                   [0,0,1,0],
191                   [0,0,0,1]])
192         linear_extrude(height= overret_gaplen + 10, convexity=100)
193         BasicSection();
194     }
195   }
196 }
197
198 module Demo(){
199   color("red") translate([0,0,-3]) BasicSection();
200   color("blue") translate([0,0,3]) WithRetainSection();
201 }
202
203 module Test(){
204   linear_extrude(height=2) {
205     WithRetainSection();
206     translate([0, -handle_y0 + topprotr_y + 10])
207       BasicSection();
208   }
209 }
210
211 //Demo();
212 //HandleSection();
213 //InsertSection();
214 //WithRetainSection();
215 //BasicSection();
216 //GappingSection();
217 //Test();
218 //Demo();
219 Handle();