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