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