chiark / gitweb /
flyscreen-handle: provide GappingSection
[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(gapping=false){
89   rotate(180-retain_empir_angle)
90     translate([0,ins_orad]) {
91     difference(){
92       circle(r=retain_rad + cutout_gap, $fn=20);
93       if (!gapping)
94         rotate(180 + retain_empir_angle/2)
95           translate([0, -retain_empir_stalkw])
96           square([100, retain_empir_stalkw*2]);
97     }
98   }
99 }  
100
101 module GappingSection(){
102   difference(){
103     InsertSection();
104     RetainCutout(true);
105   }
106   HandleSection();
107 }
108
109 module WithRetainSection(){
110   difference(){
111     InsertSection();
112     RetainCutout();
113   }
114   HandleSection();
115   RetainSection();
116 }
117
118 module BasicSection(){
119   InsertSection();
120   HandleSection();
121 }
122
123 module Demo(){
124   difference(){
125     InsertSection();
126     RetainCutout();
127   }
128   HandleSection();
129   color("red") RetainSection();
130 }
131
132 module Test(){
133   linear_extrude(height=2) WithRetainSection();
134 }
135
136 //Demo();
137 //WithRetainSection();
138 //BasicSection();
139 GappingSection();
140 //Test();