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