chiark / gitweb /
flyscreen-handle: adjustment handle from v3
[reprap-play.git] / flyscreen-handle.scad
1 // -*- C -*-
2
3 opening_height = 7.84 - 0.3;
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_empir_angle = 20;
11 retain_empir_stalkw = 0.8;
12 retain_rad = 1.65;
13 retain_empir_inward = 0.65;
14
15 hgap_empir_adjust = -0.5;
16
17 topprotr_rad = 0.35;
18
19 bot_overlap = 5;
20 bot_w = 3;
21
22 handle_w = 8;
23 handle_rh = 3;
24 handle_rcut = 3;
25
26 cutout_gap = 1.5;
27
28 total_len = 35;
29 retaining_len = 10;
30 overret_gaplen = 5;
31
32 overret_hch = 5;
33
34 // calculated
35
36 ins_irad = openingcnr_dia/2 + gap;
37 ins_orad = openingcnr_dia/2 + opening_height - gap;
38 ins_th = ins_orad - ins_irad;
39
40 handle_x0 = ins_irad + hgap_empir_adjust;
41 handle_h = bot_overlap + ins_th;
42 handle_y0 = -ins_orad-bot_overlap;
43 handle_y1 = handle_y0 + handle_h;
44
45 handle_x1 = handle_x0 + bot_w + handle_w;
46
47 topprotr_y = -ins_irad + opening_topprotr;
48
49 module InsertSection(){
50   hull(){
51     translate([-ins_irad, -ins_irad])
52       mirror([1,0])
53       square([opening_depth - ins_irad, 0.1]);
54     translate([-ins_irad - topprotr_rad,
55                topprotr_y - topprotr_rad])
56       circle(r=topprotr_rad, $fn=10);
57   }
58   translate([0, -ins_orad]) square([ins_irad+1, ins_th]);
59   intersection(){
60     translate([0.1, -ins_irad + 0.1])
61       mirror([1,1])
62       square([100, opening_depth]);
63     difference(){
64       circle(r= ins_orad);
65       circle(r= ins_irad, $fn=20);
66     }
67   }
68 }
69
70 module HandleSection(){
71   difference(){
72     hull(){
73       translate([handle_x0, handle_y0])
74         square([bot_w, handle_h]);
75       for (y= [handle_y1 - handle_rh/2,
76                handle_y1 - ins_th + handle_rh/2]) {
77         translate([handle_x1 - handle_rh/2, y])
78           circle(r= handle_rh/2, $fn=20);
79       }
80     }
81     hull(){
82       for (x= [handle_x0 + bot_w + handle_rcut/2,
83                handle_x1 - handle_rh/2 - handle_rcut/2]) {
84         translate([x, handle_y1])
85           circle(r = handle_rcut/2, $fn=20);
86       }
87     }
88   }
89   hull(){
90     for (y= [handle_y1 -   handle_rh/2,
91              handle_y1 - 3*handle_rh/2])
92       translate([handle_x1 - handle_rh/2, y])
93         circle(r = handle_rh/2, $fn=20);
94   }
95 }
96
97 module RetainSection(){
98   rotate(180-retain_empir_angle)
99     translate([0, ins_orad - retain_empir_inward])
100     circle(r=retain_rad, $fn=20);
101 }
102
103 module RetainCutout(gapping=false){
104   rotate(180-retain_empir_angle)
105     translate([0, ins_orad - retain_empir_inward]) {
106     difference(){
107       circle(r=retain_rad + cutout_gap, $fn=20);
108       if (!gapping)
109         rotate(180 + retain_empir_angle/2)
110           translate([0, -retain_empir_stalkw])
111           square([100, retain_empir_stalkw*2]);
112     }
113   }
114 }  
115
116 module GappingSection(){
117   difference(){
118     InsertSection();
119     RetainCutout(true);
120   }
121   HandleSection();
122 }
123
124 module WithRetainSection(){
125   difference(){
126     InsertSection();
127     RetainCutout();
128   }
129   HandleSection();
130   RetainSection();
131 }
132
133 module BasicSection(){
134   InsertSection();
135   HandleSection();
136 }
137
138 module Handle(){
139   bs0 = retaining_len + overret_gaplen;
140   bs1 = bs0 + overret_hch;
141   linear_extrude(height=total_len, convexity=100) GappingSection();
142   linear_extrude(height=retaining_len, convexity=100) WithRetainSection();
143   translate([0,0, bs1]) linear_extrude(height= total_len - bs1)
144     BasicSection();
145   translate([0,0, bs1+0.1]) mirror([0,0,1]) {
146     intersection_for (sl=[0,1]) {
147       multmatrix([[1,0,0,0],
148                   [0,1,sl*0.65,0],
149                   [0,0,1,0],
150                   [0,0,0,1]])
151         linear_extrude(height= overret_gaplen+1, convexity=100)
152         BasicSection();
153     }
154   }
155 }
156
157 module Demo(){
158   difference(){
159     InsertSection();
160     RetainCutout();
161   }
162   HandleSection();
163   color("red") RetainSection();
164 }
165
166 module Test(){
167   linear_extrude(height=2) {
168     WithRetainSection();
169     translate([0, -handle_y0 + topprotr_y + 10])
170       BasicSection();
171   }
172 }
173
174 //Demo();
175 //WithRetainSection();
176 //BasicSection();
177 //GappingSection();
178 Test();
179 //Handle();