chiark / gitweb /
38c3dea3517f3e98c3f75ddd34afa0afa26c5ee8
[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 opening_protr_slop = 0.1;
24
25 intooth_top_slop = 0.1;
26 inside_h_xgap = 1;
27
28 pivot_r = 2;
29 pivot_slop = 0.25;
30
31 width = 5;
32
33 // calculated
34
35 inside_h = opening_height/2 - opening_protrh - inside_h_xgap/2;
36
37 edge_or = openingedge_dia/2 + opening_protr_slop;
38
39 Q0 = [ openingedge_dia/2,
40        openingedge_dia/2 + opening_height/2 ];
41
42 p4p5d = [edge_or + ourcirc_r, 0];
43
44 P0 = [ pivot_x, pivoting_gap ];
45 P4 = Q0 - p4p5d;
46 P3t = [ P4[0], Q0[1] - openingedge_dia/2 + opening_protrh
47         - intooth_top_slop - ourcirc_r ];
48 P2 = P4 + [ -(inside_len - ourcirc_r*2), 0 ];
49 P1 = [ P2[0], P3t[1] - (inside_h + ourcirc_r*2) ];
50 P9 = [ outside_len - ourcirc_r, outside_gap/2 + ourcirc_r ];
51 P8 = P9 + [ 0, outend_height - ourcirc_r*2 ];
52 P5 = Q0 + p4p5d;
53 P6b = P5 + [ -outside_push_inadj, outside_pushh - ourcirc_r*2 ];
54 P7b = [ P6b[0] + (P6b[1] - P1[1]) / outside_pushslope,
55         P1[1] ];
56
57 P3b = P3t + [ -outside_push_inadj * (P3t[1]-P4[1]) / (P6b[1]-P5[1]), 0 ];
58
59 module ExtrusionSect(){
60   cr = openingedge_dia/2;
61   toph = opening_height/2 + opening_protrh;
62
63   for (my=[0,1]) {
64     mirror([0,my]) {
65       translate(Q0) {
66         hull(){
67           circle(r=cr, $fn=20);
68           translate([-cr,10]) square([cr*2, 1]);
69         }
70       }
71     }
72   }
73   translate([-opening_depth, -toph]) {
74     difference(){
75       translate([-5,-5])
76         square([opening_depth+6, toph*2+10]);
77       square([opening_depth+2, toph*2]);
78     }
79   }
80 }
81
82 module PsHull(ps) {
83   hull(){
84     for (p = ps) {
85       translate(p)
86         circle(r = ourcirc_r, $fn=10);
87     }
88   }
89 }
90
91 module LeverSect(P3){
92   PsHull([P2, P3, P4]);
93   difference(){
94     PsHull([P0,P1,P2,P5,P8,P9]);
95     translate(Q0) {
96       hull(){
97         circle(r=edge_or, $fn=20);
98         translate([0,10]) circle(r=edge_or, $fn=20);
99       }
100     }
101   }
102 }
103
104 module LeverSectTop(){
105   difference(){
106     LeverSect(P3t);
107     translate([pivot_x,0]) circle(r= pivot_r + pivot_slop, $fn=20);
108   }
109 }
110
111 module LeverSectBot(){
112   mirror([0,1]) {
113     LeverSect(P3b);
114     PsHull([P5,P6b,P7b]);
115     translate([pivot_x,0]) circle(r=pivot_r, $fn=20);
116   }
117 }
118
119 module Demo(){
120   translate([0,0,-5]) color("white") ExtrusionSect();
121   LeverSectTop();
122   LeverSectBot();
123 }
124
125 module LeverTop(){
126   linear_extrude(height=width, convexity=100) LeverSectTop();
127 }
128
129 module LeverBot(){
130   linear_extrude(height=width, convexity=100) LeverSectBot();
131 }
132
133 module Test(){
134   translate([0,2,0]) LeverTop();
135   LeverBot();
136 }
137
138 //Demo();
139 Test();