chiark / gitweb /
flyscreen-handle: Before P9 strap
[reprap-play.git] / flyscreen-handle.scad
1 // -*- C -*-
2
3 opening_height = 7.84;
4 opening_depth = 7.88;
5 openingedge_dia = 1.34;
6 opening_protrh = 1.8;
7
8 pivot_x = 6;
9 inside_len = 4;
10
11 pivoting_gap = 0.1;
12
13 outside_gap = 3;
14 outside_len = 16;
15 outend_height = 3;
16
17 outside_pushh = 4;
18 outside_pushslope = 1.4;
19 outside_push_inadj = 0.82;
20
21 ourcirc_r = 0.5 / 2;
22
23 ribble_dia = 2.2;;
24
25 opening_protr_slop = 0.1;
26
27 intooth_top_slop = 0.1;
28 inside_h_xgap = 1;
29
30 pivot_r = 2;
31 pivot_slop = 0.25;
32
33 width = 5;
34
35 // calculated
36
37 inside_h = opening_height/2 - opening_protrh - inside_h_xgap/2;
38
39 edge_or = openingedge_dia/2 + opening_protr_slop;
40
41 Q0 = [ openingedge_dia/2,
42        openingedge_dia/2 + opening_height/2 ];
43
44 p4p5d = [edge_or + ourcirc_r, 0];
45
46 P0 = [ pivot_x, pivoting_gap ];
47 P4 = Q0 - p4p5d;
48 P3t = [ P4[0], Q0[1] - openingedge_dia/2 + opening_protrh
49         - intooth_top_slop - ourcirc_r ];
50 P2 = P4 + [ -(inside_len - ourcirc_r*2), 0 ];
51 P1 = [ P2[0], P3t[1] - (inside_h + ourcirc_r*2) ];
52
53 P5 = Q0 + p4p5d;
54
55 P9mid = [ outside_len - ourcirc_r, outside_gap/2 + ourcirc_r ];
56 P8mid = P9mid + [ 0, outend_height - ourcirc_r*2 ];
57
58 P89adj = [ 0, P5[1] - P8mid[1] ];
59
60 P8t = P8mid + P89adj;
61 P9t = P9mid + P89adj;
62
63 P6t = P5 + [ 0, outside_pushh - ourcirc_r*2 ];
64 P7 = [ P6t[0] + (P6t[1] - P1[1]) / outside_pushslope,
65        P1[1] ];
66
67 P3a = P3t + [ -outside_push_inadj, 0 ];
68 P6a = P6t + [ -outside_push_inadj, 0 ];
69
70 outside_push_inadj_slope = (P3t[1]-P4[1]) / (P6a[1]-P5[1]);
71
72 ribble_rad = ribble_dia/2;
73
74 module ExtrusionSect(){
75   cr = openingedge_dia/2;
76   toph = opening_height/2 + opening_protrh;
77
78   for (my=[0,1]) {
79     mirror([0,my]) {
80       translate(Q0) {
81         hull(){
82           circle(r=cr, $fn=20);
83           translate([-cr,10]) square([cr*2, 1]);
84         }
85       }
86     }
87   }
88   translate([-opening_depth, -toph]) {
89     difference(){
90       translate([-5,-5])
91         square([opening_depth+6, toph*2+10]);
92       square([opening_depth+2, toph*2]);
93     }
94   }
95 }
96
97 module PsHull(ps) {
98   hull(){
99     for (p = ps) {
100       translate(p)
101         circle(r = ourcirc_r, $fn=10);
102     }
103   }
104 }
105
106 module LeverSect(top, inadj=false){
107   P3 = inadj ? P3a : P3t;
108   P8 = top ? P8t : P8mid - P89adj;
109   P9 = top ? P9t : P9mid - P89adj;
110   diag = inadj ? 0 : atan(outside_push_inadj_slope);
111   PsHull([P2,P3,P4]);
112   difference(){
113     PsHull([P0,P1,P2,P5,P8,P9]);
114     translate(Q0) {
115       rotate(diag){
116         hull(){
117           circle(r=edge_or, $fn=20);
118           translate([0,10]) circle(r=edge_or, $fn=20);
119         }
120       }
121     }
122   }
123 }
124
125 module StrapSect(){
126   translate(P9t) {
127     difference(){
128       circle(r = 4);
129       circle(r = 2);
130     }
131   }
132 }
133
134 module LeverSectTop(){
135   difference(){
136     union(){
137       LeverSect(true, false);
138       for (x = [ P8t[0] + ourcirc_r - ribble_rad :
139                  -ribble_rad * 4 :
140                  Q0[0] + edge_or + ribble_rad*2 ]) {
141         translate([x, P5[1] + ourcirc_r])
142           circle(r = ribble_rad, $fn=20);
143       }
144     }
145     translate([pivot_x,0]) circle(r= pivot_r + pivot_slop, $fn=20);
146   }
147 }
148
149 module LeverSectBot(inadj=false){
150   P6 = inadj ? P6a : P6t;
151   mirror([0,1]) {
152     LeverSect(false, inadj);
153     PsHull([P5,P6,P7]);
154     translate([pivot_x,0]) circle(r=pivot_r, $fn=20);
155   }
156 }
157
158 module Demo(){
159   translate([0,0,-5]) color("white") ExtrusionSect();
160   LeverSectTop();
161   translate([0,0,5]) LeverSectBot();
162   color("black") LeverSectBot(true);
163   color("blue") translate([0,0,10]) StrapSect();
164 }
165
166 module LeverTop(){
167   linear_extrude(height=width, convexity=100) LeverSectTop();
168 }
169
170 module LeverBot(inadj=false){
171   linear_extrude(height=width, convexity=100) LeverSectBot(inadj);
172 }
173
174 module Test(){
175   translate([0,2,0]) LeverTop();
176   LeverBot();
177   translate([0,-opening_height - 2,0]) LeverBot(true);
178 }
179
180 Demo();
181 //Test();