chiark / gitweb /
flyscreen-handle: LeverSects wip
[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 = 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
20 ourcirc_r = 0.5 / 2;
21
22 opening_protr_slop = 0.1;
23
24 intooth_top_slop = 0.1;
25 inside_h_xgap = 1;
26
27 // calculated
28
29 inside_h = opening_height/2 - opening_protrh - inside_h_xgap/2;
30
31 edge_or = openingedge_dia/2 + opening_protr_slop;
32
33 Q0 = [ openingedge_dia/2,
34        openingedge_dia/2 + opening_height/2 ];
35
36 p4p5d = [edge_or + ourcirc_r, 0];
37
38 P0 = [ pivot_x, pivoting_gap ];
39 P4 = Q0 - p4p5d;
40 P3 = [ P4[0], Q0[1] - openingedge_dia/2 + opening_protrh
41        - intooth_top_slop - ourcirc_r ];
42 P2 = P4 + [ -(inside_len - ourcirc_r*2), 0 ];
43 P1 = [ P2[0], P3[1] - (inside_h + ourcirc_r*2) ];
44 P9 = [ outside_len - ourcirc_r, outside_gap/2 + ourcirc_r ];
45 P8 = P9 + [ 0, outend_height - ourcirc_r*2 ];
46 P5 = Q0 + p4p5d;
47 P6 = P5 + [ 0, outside_pushh - ourcirc_r*2 ];
48 P7 = [ P6[0] + (P6[1] - P1[1]) / outside_pushslope,
49        P1[1] ];
50
51 module ExtrusionSect(){
52   cr = openingedge_dia/2;
53   toph = opening_height/2 + opening_protrh;
54
55   for (my=[0,1]) {
56     mirror([0,my]) {
57       translate(Q0) {
58         hull(){
59           circle(r=cr, $fn=20);
60           translate([-cr,10]) square([cr*2, 1]);
61         }
62       }
63     }
64   }
65   translate([-opening_depth, -toph]) {
66     difference(){
67       translate([-5,-5])
68         square([opening_depth+6, toph*2+10]);
69       square([opening_depth+2, toph*2]);
70     }
71   }
72 }
73
74 module PsHull(ps) {
75   hull(){
76     for (p = ps) {
77       translate(p)
78         circle(r = ourcirc_r, $fn=10);
79     }
80   }
81 }
82
83 module LeverSect(){
84   PsHull([P2,P3,P4]);
85   PsHull([P5,P6,P7]);
86   difference(){
87     PsHull([P0,P1,P2,P5,P8,P9]);
88     translate(Q0) {
89       hull(){
90         circle(r=edge_or, $fn=20);
91         translate([0,10]) circle(r=edge_or, $fn=20);
92       }
93     }
94   }
95 }
96
97 module LeverSectTop(){
98   LeverSect();
99 }
100
101 module LeverSectBot(){
102   mirror([0,1]) {
103     LeverSect();
104   }
105 }
106
107 module Demo(){
108   translate([0,0,-5]) color("white") ExtrusionSect();
109   LeverSectTop();
110   LeverSectBot();
111 }
112
113 Demo();