]> www.fi.muni.cz Git - things.git/blob - rocket.scad
rocket: slight dim modifications
[things.git] / rocket.scad
1
2 // The Estes A8-3 and C6-7 motors have diameter of 17.7 mm,
3 // length 69.5 mm. The Estes Alpha launch pad has rod diameter 3.4 mm.
4
5 motor_diam = 17.7 + 0.8; // add some tolerance
6 motor_len  = 69.5 + 0.5;
7
8 segment_overlap = 15;
9
10 loose_fit_diam_diff = 0.5; // cylinder with outer diameter d1
11         // will fit loosely into the hole with inner diameter
12         // d1 + loose_fit_diam_diff
13 tight_fit_diam_diff = 0.25; // cylinder with outer diameter d1
14         // will fit tightly into the hole with inner diameter
15         // d1 + tight_fit_diam_diff
16
17 thin_wall = 1.0; // depends on the print width
18 thick_wall = 2*thin_wall + loose_fit_diam_diff/2;
19         // motor_diam + 2*thick_wall is the outer diameter of the rocket
20 motor_wall = thick_wall; // above the motor
21
22 clip_height = 3.5;
23 clip_width = 1.2;
24 clip_clearance = 1.0;
25 clip_inner_space = motor_diam/2 - 1.0;
26
27 rod_diam = 3.4 + 1;
28 rubber_beam_height = 3;
29 rubber_beam_width = 1.5;
30
31 fin_thickness = 1.5;
32
33 eps = 0.01;
34 infty = 250;
35
36 //----------------- MOTOR MODULE -----------------------------
37
38 module fin() {
39         assign(h1 = 2*motor_len/3, // near end height
40                 h2 = 20,        // far end height
41                 h_off = motor_len, // height offset of the far height
42                 w = 30, // distance of the far height
43                 fin_w = fin_thickness)
44         translate([0, -fin_w/2, -h1])
45         hull() { 
46                 cube([eps, fin_w, h1]); // near end
47                 translate([w, 0, h_off]) // far end
48                         cube([eps, fin_w, h2]);
49         };
50 };
51
52 // alternative fin layout
53 module fin2() {
54         assign(h1 = motor_len/2, // near end height
55                 w2 = 23,        // bottom/far end width
56                 h_off = 60, // height offset of the far height
57                 w = 30, // distance of the far height
58                 fin_w = fin_thickness)
59         translate([0, -fin_w/2, -h1])
60         hull() { 
61                 cube([eps, fin_w, h1]); // near end
62                 translate([w-w2, 0, h_off]) // far end
63                         cube([w2, fin_w, eps]);
64         };
65 };
66
67 rod_hole_height = 20;
68 rod_hole_side = 1.5*(rod_diam + thin_wall);
69
70 module motor_module_solid()
71 {
72         // cone from loose_fit to tight fit, 1/3 of segment overlap
73         cylinder(r1 = motor_diam/2 + thin_wall,
74                 r2 = motor_diam/2 + thick_wall - thin_wall - tight_fit_diam_diff/2,
75                 h = segment_overlap/3 + eps);
76
77         // tight fit cylinder, 2/3 of segment overlap
78         translate([0, 0, segment_overlap/3])
79                 cylinder(r = motor_diam/2 + thick_wall - thin_wall - tight_fit_diam_diff/2,
80                 h = 2*segment_overlap/3 + eps);
81
82         // conical joint between the two cylinders
83         translate([0, 0, segment_overlap - thick_wall + thin_wall])
84                 cylinder(r1 = motor_diam/2 + thick_wall - thin_wall - tight_fit_diam_diff/2,
85                         r2 = motor_diam/2 + thick_wall,
86                         h = thick_wall - thin_wall + eps);
87
88         // the thick cylinder above it
89         translate([0, 0, segment_overlap])
90                 cylinder(r = motor_diam/2 + thick_wall,
91                 h = motor_len + motor_wall - segment_overlap);
92
93         // fins
94         for (a = [60, 180, 300]) {
95                 rotate([0, 0, a])
96                 translate([motor_diam/2 + thick_wall-thin_wall, 0, motor_wall + motor_len])
97                         // fin();
98                         fin2();
99         };
100
101         // rod hole holder
102         hull() {
103                 translate([motor_diam/2 + thick_wall - rod_diam/2 - thin_wall,
104                         0, segment_overlap])
105                         scale([1, 1.4, 1])
106                         cylinder(r = rod_diam/2 + thin_wall, h = eps);
107                 translate([motor_diam/2 + thick_wall + thin_wall + rod_diam/2, 0, segment_overlap + rod_hole_side])
108                         scale([1, 1.1, 1])
109                         cylinder(r = rod_diam/2 + thin_wall, h = rod_hole_height);
110                 translate([motor_diam/2 + thick_wall - rod_diam/2 - thin_wall,
111                         0, segment_overlap + 2*rod_hole_side + rod_hole_height])
112                         scale([1, 1.4, 1])
113                         cylinder(r = rod_diam/2 + thin_wall, h = eps);
114         };
115
116         // motor clip
117         for (angle = [120, -120]) rotate([0, 0, angle]) intersection() {
118                 translate([clip_inner_space, -infty/2,
119                         motor_len + motor_wall + clip_clearance])
120                         cube([clip_width, infty, clip_height]);
121                 rotate([0, 0, -60])
122                         translate([-infty/2, 0, 0]) cube(infty);
123                 rotate([0, 0, -120])
124                         translate([-infty/2, 0, 0]) cube(infty);
125         };
126 };
127         
128 module motor_module() {
129         difference() {
130                 motor_module_solid();
131
132                 // top ring to hold the motor inside
133                 translate([0, 0, -eps])
134                         cylinder(r = motor_diam/2 - motor_wall,
135                                 h = motor_wall + 2*eps);
136
137                 // motor hole
138                 translate([0, 0, motor_wall - eps])
139                         cylinder(r = motor_diam/2, h = motor_len + 2*eps);
140
141                 // three rails inside the motor hole
142                 translate([0, 0, segment_overlap + thick_wall]) difference() {
143                         union() {
144                                 cylinder(r = motor_diam/2 + thin_wall,
145                                         h = motor_len - segment_overlap - 2*thick_wall + eps);
146                                 translate([0, 0, motor_len - segment_overlap - 2*thick_wall])
147                                         cylinder(r1 = motor_diam/2 + thin_wall, r2 = motor_diam/2, h = thick_wall + eps);
148                         };
149                         for (a = [0, 120, 240]) rotate([0, 0, a])
150                                 translate([motor_diam/2 + 2.5, 0, -eps])
151                                         cylinder(r = 3, h = infty);
152                 };
153
154                 // rod hole
155                 translate([motor_diam/2 + thick_wall + thin_wall + eps + rod_diam/2, 0, 0])
156                         cylinder(r = rod_diam/2, h = infty);
157         };
158 };
159
160 // -------------------- CENTRAL TUBE ---------------------
161
162 central_tube_h = 97;
163
164 central_clip_r = 12;
165 central_clip_w = 4;
166 central_clip_wall = 1.5;
167 central_clip_clearance = 2.5;
168
169 module central_tube_solid() {
170         cylinder(r = motor_diam/2 + thick_wall, h = central_tube_h);
171 };
172
173 module central_tube() {
174         difference() {
175                 central_tube_solid();
176                 translate([0, 0, -eps])
177                         cylinder(r = motor_diam/2 + thick_wall - thin_wall,
178                                 h = infty);
179         };
180         // rubber band holder
181         intersection() {
182                 cylinder(r = motor_diam/2 + thick_wall - eps, h = central_tube_h);
183 /*
184                 translate([motor_diam/2 - thick_wall, -infty/2,
185                         segment_overlap + thick_wall])
186                         cube([thin_wall, infty, rubber_beam_height]);
187 */
188                 translate([-central_clip_w/2,
189                         central_clip_r + motor_diam/2 + thick_wall - 2*thin_wall - central_clip_clearance,
190                         central_tube_h/3]) rotate([0, 90, 0]) difference() {
191                         cylinder(r = central_clip_r, h = central_clip_w);
192                         translate([0, 0, -eps])
193                                 cylinder(r = central_clip_r - central_clip_wall, h = central_clip_w + 2*eps);
194                 }
195         };
196 };
197
198 //------------------------- FRONT CONE -----------------------
199 cone_h = 45;
200 cone_resolution = 40;
201 cone_solid_h = 10;
202
203 function bez_i4(t, ctls) =
204         (pow(1-t, 3) * ctls[0])
205         + (3 * t * pow(1-t, 2) * ctls[1])
206         + (3 * pow(t, 2) * (1-t) * ctls[2])
207         + (pow(t, 3) * ctls[3]);
208
209 module bezier_cone(cps, res)
210 {
211         for (t = [0:1:res])
212                 translate([0, 0, (bez_i4(t/res, cps))[0]])
213                         cylinder(r1 = (bez_i4(t/res, cps))[1],
214                                 r2 = (bez_i4((t + 1)/res, cps))[1],
215                                 h = (bez_i4((t + 1)/res, cps))[0]
216                                     - (bez_i4(t/res, cps))[0] + eps);
217 };
218
219 module front_cone_body() {
220         translate([0, 0, segment_overlap])
221                 bezier_cone([
222                         [ 0, motor_diam/2 + thick_wall ], // start
223                         [ cone_h/4, motor_diam/2 + thick_wall ], // cp 1
224                         [ cone_h - motor_diam/2 - thick_wall, motor_diam/2 + thick_wall ], // cp 2
225                         [ cone_h, 0 ],
226                 ], 40);
227
228         translate([0, 0, segment_overlap-thick_wall+thin_wall])
229                 cylinder(r1 = motor_diam/2+thin_wall,
230                         r2 = motor_diam/2 + thick_wall,
231                         h = thick_wall - thin_wall + eps);
232
233         cylinder(r = motor_diam/2+thin_wall, h = segment_overlap + eps);
234 };
235
236 module front_cone() {
237         difference() {
238                 front_cone_body();
239                 intersection() {
240                         translate([0, 0, segment_overlap])
241                                 bezier_cone([
242                                         [ 0.7*thin_wall, motor_diam/2 + thick_wall - thin_wall ], // start
243                                 [ cone_h/4-0.7*thin_wall, motor_diam/2 + thick_wall - thin_wall], // cp 1
244                                 [ cone_h - motor_diam/2 - thick_wall + thin_wall - 1.4*thin_wall, motor_diam/2 + thick_wall - thin_wall ], // cp 2
245                                 [ cone_h - 1.4*thin_wall, 0 ],
246                         ], 40);
247                         cylinder(r = motor_diam/2 + thick_wall + eps,
248                                 h = cone_h + segment_overlap - cone_solid_h);
249                 };
250
251                 translate([0, 0, segment_overlap-thick_wall+1.7*thin_wall])
252                         cylinder(r1 = motor_diam/2,
253                                 r2 = motor_diam/2 + thick_wall-thin_wall,
254                                 h = thick_wall-thin_wall + eps);
255
256                 translate([0, 0, -eps])
257                         cylinder(r = motor_diam/2, h = segment_overlap + 2*eps);
258         };
259         // rubber band holder
260         intersection() {
261                 cylinder(r = motor_diam/2 + thin_wall/2, h = segment_overlap);
262                 translate([motor_diam/3-thin_wall/2, -infty/2,
263                         segment_overlap - thick_wall - rubber_beam_height - eps])
264                         cube([rubber_beam_width, infty, rubber_beam_height]);
265         };
266 };
267
268 debug = 0;
269
270 if (debug == 1) {
271 // debug
272 difference($fn = 16) {
273         front_cone();
274         // central_tube();
275         // motor_module();
276
277         translate([0, 0, -infty/2]) cube(infty);
278 };
279
280 } else {
281
282 // production
283 assign($fn = 128) {
284
285 translate([motor_diam + thick_wall, 0, 0])
286         motor_module();
287
288 rotate([0, 0, 120])
289 translate([motor_diam + thick_wall, 0, 0])
290         central_tube();
291
292 rotate([0, 0, 240])
293 translate([motor_diam + thick_wall, 0, 0])
294         front_cone();
295
296 }
297 }