chiark / gitweb /
flyscreen-handle: provide BasicSection
[reprap-play.git] / flyscreen-handle.scad
1 // -*- C -*-
2
3 opening_height = 7.84;
4 opening_depth = 7.88;
5 openingcnr_dia = 2.75;
6 opening_topprotr = 1.54;
7
8 gap = 0.25;
9
10 retain_empir_angle = 20;
11 retain_empir_stalkw = 1.0;
12 retain_rad = 1.5;
13
14 topprotr_rad = 0.35;
15
16 bot_overlap = 5;
17 bot_w = 3;
18
19 handle_d = 2;
20 handle_w = 8;
21 handle_rh = 2;
22 handle_rcut = 3;
23
24 cutout_gap = 1.5;
25
26 // calculated
27
28 ins_irad = openingcnr_dia/2 + gap;
29 ins_orad = openingcnr_dia/2 + opening_height - gap;
30 ins_th = ins_orad - ins_irad;
31
32 handle_x0 = ins_irad;
33 handle_h = bot_overlap + ins_th;
34 handle_y0 = -ins_orad-bot_overlap;
35 handle_y1 = handle_y0 + handle_h;
36
37 handle_x1 = handle_x0 + bot_w + handle_w;
38
39 module InsertSection(){
40   hull(){
41     translate([-ins_orad, 0]) square([ins_th, 0.1]);
42     translate([-ins_irad - topprotr_rad,
43                opening_topprotr - topprotr_rad])
44       circle(r=topprotr_rad, $fn=10);
45   }
46   translate([0, -ins_orad]) square([ins_irad+1, ins_th]);
47   intersection(){
48     translate([0.1,0.1]) mirror([1,1]) square([100,100]);
49     difference(){
50       circle(r= ins_orad);
51       circle(r= ins_irad, $fn=20);
52     }
53   }
54 }
55
56 module HandleSection(){
57   difference(){
58     hull(){
59       translate([handle_x0, handle_y0])
60         square([bot_w, handle_h]);
61       for (y= [handle_y1 - handle_rh/2,
62                handle_y1 - ins_th + handle_rh/2]) {
63         translate([handle_x1 - handle_rh/2, y])
64           circle(r= handle_rh/2, $fn=20);
65       }
66     }
67     hull(){
68       for (x= [handle_x0 + bot_w + handle_rcut/2,
69                handle_x1 - handle_rh/2 - handle_rcut/2]) {
70         translate([x, handle_y1])
71           circle(r = handle_rcut/2, $fn=20);
72       }
73     }
74   }
75   hull(){
76     for (y= [handle_y1 -   handle_rh/2,
77              handle_y1 - 3*handle_rh/2])
78       translate([handle_x1 - handle_rh/2, y])
79         circle(r = handle_rh/2, $fn=20);
80   }
81 }
82
83 module RetainSection(){
84   rotate(180-retain_empir_angle)
85     translate([0,ins_orad]) circle(r=retain_rad, $fn=20);
86 }
87
88 module RetainCutout(){
89   rotate(180-retain_empir_angle)
90     translate([0,ins_orad]) {
91     difference(){
92       circle(r=retain_rad + cutout_gap, $fn=20);
93       rotate(180 + retain_empir_angle/2)
94         translate([0, -retain_empir_stalkw])
95         square([100, retain_empir_stalkw*2]);
96     }
97   }
98 }  
99
100 module WithRetainSection(){
101   difference(){
102     InsertSection();
103     RetainCutout();
104   }
105   HandleSection();
106   RetainSection();
107 }
108
109 module BasicSection(){
110   InsertSection();
111   HandleSection();
112 }
113
114 module Demo(){
115   difference(){
116     InsertSection();
117     RetainCutout();
118   }
119   HandleSection();
120   color("red") RetainSection();
121 }
122
123 module Test(){
124   linear_extrude(height=2) WithRetainSection();
125 }
126
127 //Demo();
128 //WithRetainSection();
129 BasicSection();
130 //Test();