chiark / gitweb /
flyscreen-handle: Ribbles
[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 P6t = P5 + [ 0, outside_pushh - ourcirc_r*2 ];
61 P7 = [ P6t[0] + (P6t[1] - P1[1]) / outside_pushslope,
62        P1[1] ];
63
64 P3a = P3t + [ -outside_push_inadj, 0 ];
65 P6a = P6t + [ -outside_push_inadj, 0 ];
66
67 outside_push_inadj_slope = (P3t[1]-P4[1]) / (P6a[1]-P5[1]);
68
69 ribble_rad = ribble_dia/2;
70
71 module ExtrusionSect(){
72   cr = openingedge_dia/2;
73   toph = opening_height/2 + opening_protrh;
74
75   for (my=[0,1]) {
76     mirror([0,my]) {
77       translate(Q0) {
78         hull(){
79           circle(r=cr, $fn=20);
80           translate([-cr,10]) square([cr*2, 1]);
81         }
82       }
83     }
84   }
85   translate([-opening_depth, -toph]) {
86     difference(){
87       translate([-5,-5])
88         square([opening_depth+6, toph*2+10]);
89       square([opening_depth+2, toph*2]);
90     }
91   }
92 }
93
94 module PsHull(ps) {
95   hull(){
96     for (p = ps) {
97       translate(p)
98         circle(r = ourcirc_r, $fn=10);
99     }
100   }
101 }
102
103 module LeverSect(P89adjsense, inadj=false){
104   P3 = inadj ? P3a : P3t;
105   P8 = P8mid + P89adjsense * P89adj;
106   P9 = P9mid + P89adjsense * P89adj;
107   diag = inadj ? 0 : atan(outside_push_inadj_slope);
108   PsHull([P2,P3,P4]);
109   difference(){
110     PsHull([P0,P1,P2,P5,P8,P9]);
111     translate(Q0) {
112       rotate(diag){
113         hull(){
114           circle(r=edge_or, $fn=20);
115           translate([0,10]) circle(r=edge_or, $fn=20);
116         }
117       }
118     }
119   }
120 }
121
122 module LeverSectTop(){
123   difference(){
124     union(){
125       LeverSect(+1, false);
126       for (x = [ P8mid[0] + ourcirc_r - ribble_rad :
127                  -ribble_rad * 4 :
128                  Q0[0] + edge_or + ribble_rad*2 ]) {
129         translate([x, P5[1] + ourcirc_r])
130           circle(r = ribble_rad, $fn=20);
131       }
132     }
133     translate([pivot_x,0]) circle(r= pivot_r + pivot_slop, $fn=20);
134   }
135 }
136
137 module LeverSectBot(inadj=false){
138   P6 = inadj ? P6a : P6t;
139   mirror([0,1]) {
140     LeverSect(-1, inadj);
141     PsHull([P5,P6,P7]);
142     translate([pivot_x,0]) circle(r=pivot_r, $fn=20);
143   }
144 }
145
146 module Demo(){
147   translate([0,0,-5]) color("white") ExtrusionSect();
148   LeverSectTop();
149   LeverSectBot();
150 }
151
152 module LeverTop(){
153   linear_extrude(height=width, convexity=100) LeverSectTop();
154 }
155
156 module LeverBot(inadj=false){
157   linear_extrude(height=width, convexity=100) LeverSectBot(inadj);
158 }
159
160 module Test(){
161   translate([0,2,0]) LeverTop();
162   LeverBot();
163   translate([0,-opening_height - 2,0]) LeverBot(true);
164 }
165
166 //Demo();
167 Test();