chiark / gitweb /
flyscreen-handle: wip sort out new slopes
[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 = 8;
27 handle_rh = 3;
28 handle_rcut = 3;
29
30 cutout_gap = 1.5;
31
32 total_len = 35;
33 retaining_len = 10;
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 module InsertSection(){
60   hull(){
61     translate([-ins_irad, -ins_irad])
62       mirror([1, 0])
63       square([opening_depth - ins_irad, 0.1]);
64     translate([-ins_irad - topprotr_rad,
65                topprotr_y - topprotr_rad])
66       circle(r=topprotr_rad, $fn=10);
67   }
68   translate([0, -ins_orad]) square([ins_irad+1, ins_th]);
69   intersection(){
70     translate([0, -ins_irad])
71       mirror([1,1])
72       square([100, opening_depth]);
73     difference(){
74       circle(r= ins_orad);
75       circle(r= ins_irad, $fn=20);
76     }
77   }
78 }
79
80 module HandleSection(){
81   difference(){
82     hull(){
83       translate([handle_x0, handle_y0])
84         square([bot_w, handle_h]);
85       for (y= [handle_y1 - handle_rh/2,
86                handle_y1 - ins_th + handle_rh/2]) {
87         translate([handle_x1 - handle_rh/2, y])
88           circle(r= handle_rh/2, $fn=20);
89       }
90     }
91     hull(){
92       for (x= [handle_x0 + bot_w + handle_rcut/2,
93                handle_x1 - handle_rh/2 - handle_rcut/2]) {
94         translate([x, handle_y1])
95           circle(r = handle_rcut/2, $fn=20);
96       }
97     }
98   }
99   hull(){
100     for (y= [handle_y1 -   handle_rh/2,
101              handle_y1 - 3*handle_rh/2])
102       translate([handle_x1 - handle_rh/2, y])
103         circle(r = handle_rh/2, $fn=20);
104   }
105 }
106
107 module RetainSection(){
108   translate(retain_mxy) {
109     rotate(retain_empir_angle) {
110       circle(r=retain_rad, $fn=20);
111       square([retain_stalk_len + 1, retain_stalk_h]);
112     }
113   }
114 }
115
116 module RetainCutout(gapping=false){
117   translate(retain_mxy) {
118     rotate(retain_empir_angle) {
119       translate([-50, -retain_rad]) {
120         square([50 + retain_stalk_len,
121                 retain_cutout_h]);
122       }
123     }
124   }
125 }  
126
127 module GappingSection(){
128   difference(){
129     union(){
130       InsertSection();
131       HandleSection();
132     }
133     RetainCutout(true);
134   }
135 }
136
137 module WithRetainSection(){
138   difference(){
139     union(){
140       InsertSection();
141       HandleSection();
142     }
143     RetainCutout();
144   }
145   RetainSection();
146 }
147
148 module BasicSection(){
149   InsertSection();
150   HandleSection();
151 }
152
153 module Handle(){
154   bs0 = retaining_len + overret_gaplen;
155   bs1 = bs0 + overret_hch;
156   linear_extrude(height=total_len, convexity=100) GappingSection();
157   linear_extrude(height=retaining_len, convexity=100) WithRetainSection();
158   translate([0,0, bs1]) linear_extrude(height= total_len - bs1)
159     BasicSection();
160   translate([0,0, bs1+0.1]) mirror([0,0,1]) {
161     intersection_for (sl=[0,1]) {
162       multmatrix([[1,0,0,0],
163                   [0,1,sl,0],
164                   [0,0,1,0],
165                   [0,0,0,1]])
166         linear_extrude(height= overret_gaplen + 10, convexity=100)
167         BasicSection();
168     }
169   }
170 }
171
172 module Demo(){
173   color("red") translate([0,0,-3]) BasicSection();
174   color("blue") translate([0,0,3]) WithRetainSection();
175 }
176
177 module Test(){
178   linear_extrude(height=2) {
179     WithRetainSection();
180     translate([0, -handle_y0 + topprotr_y + 10])
181       BasicSection();
182   }
183 }
184
185 //Demo();
186 //HandleSection();
187 //InsertSection();
188 //WithRetainSection();
189 //BasicSection();
190 //GappingSection();
191 //Test();
192 //Demo();
193 Handle();