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