Browse Source

finished rail-laser

Thomas Buck 4 years ago
parent
commit
7b354a68ec
1 changed files with 215 additions and 66 deletions
  1. 215
    66
      rail-laser/rail-laser.scad

+ 215
- 66
rail-laser/rail-laser.scad View File

@@ -2,18 +2,93 @@ include <roundedcube.scad>
2 2
 
3 3
 $fn = 50;
4 4
 
5
-rail_width = 21.0 + 0.2;
6
-rail_height = 6.0 + 0.2 + 2;
7
-rail_lip_width_small = 1.5 - 0.2;
8
-rail_lip_width_big = 3.5 - 0.2;
9
-rail_lip_height = 1.1 - 0.1;
5
+bodies_gap = 0.05;
6
+
7
+laser_dia = 6.5;
8
+laser_len = 14.0;
9
+
10
+bat_width = 18.0;
11
+bat_length = 30.0;
12
+bat_height = 9.0;
13
+bat_case_add = 1.0;
14
+
15
+switch_hole_dia = 2.2;
16
+switch_hole_dist = 15.0;
17
+switch_length = 19.6;
18
+switch_length_body = 10.6;
19
+switch_width = 5.7;
20
+switch_height = 12.0 + 2.0;
21
+switch_nub = 3.0;
22
+
23
+body_width = 25.0;
24
+body_length = 50.0;
25
+body_height = 42.0;
26
+body_frame_offset = 2.5;
27
+body_frame_gap = 0.5;
28
+body_cube_rounding = 1.0;
29
+body_bat_off = 5.5;
30
+body_switch_off_x = bat_height + 6.0;
31
+body_switch_off_y = 4.0;
32
+body_switch_add = 0.5;
33
+body_hole_dia_left = 2.5;
34
+body_hole_dia_right = 2.2;
35
+body_hole_off_x = 2.2;
36
+body_hole_off_z = body_hole_off_x;
37
+body_rail_lock_off_x = 10.0;
38
+body_rail_lock_off_z = 4.0;
39
+
40
+rail_width = 21.2;
41
+rail_height = 8.2;
42
+rail_lip_width_small = 1.3;
43
+rail_lip_width_big = 3.3;
44
+rail_lip_height = 1.0;
45
+
46
+rail_lock_width = 20.0;
47
+rail_lock_depth = 10.0;
48
+rail_lock_base_height = 3.0;
49
+rail_lock_pin_size = 5.0;
50
+rail_lock_pin_width = 10.0;
51
+rail_lock_pin_height = 5.0;
52
+rail_lock_tab_len = 1.0;
53
+rail_lock_tab_depth = 2.0;
54
+rail_lock_whole_width = body_width + (2 * rail_lock_tab_len);
55
+rail_lock_tab_width = (rail_lock_whole_width - rail_lock_width) / 2;
56
+rail_lock_travel = 5.0;
57
+rail_lock_spring_dia = 7.0;
58
+rail_lock_spring_hole = 1.0;
59
+
60
+frame_gap = 0.25;
61
+frame_sphere = 20;
62
+frame_add_touch = 4.0;
63
+frame_wall = 1.5;
64
+frame_mount_hole = 3.0;
65
+frame_mount_hole_off = 6.0;
66
+frame_mid_len = (frame_mount_hole / 4) + (2 * frame_wall);
67
+frame_mid_dia = laser_dia + (2 * frame_wall);
68
+frame_tail_len = 8.0;
69
+frame_tail_width = frame_mid_dia + 0.5;
70
+frame_negative_width = frame_sphere * 2 / 3 + 7;
71
+frame_hole_dia = 2.9;
72
+frame_hole_dia_arch = 3.3;
73
+frame_hole_off = 1.8;
74
+frame_hole_neg_off = 10;
75
+frame_hole_neg_len = 15;
76
+frame_hole_neg_deg_a = 9;
77
+frame_hole_neg_deg_b = frame_hole_neg_deg_a;
78
+
79
+frame_hole_neg_rad_small = frame_mid_len + ((frame_sphere + frame_tail_len) / 2) - frame_hole_off;
80
+frame_hole_neg_rad_large = frame_mid_len + ((frame_sphere + frame_tail_len) / 2) + frame_hole_off;
81
+frame_len = frame_sphere + frame_mid_len + frame_tail_len;
82
+
83
+//body_frame_off = body_height - rail_height - (frame_sphere / 2) - body_frame_offset;
84
+body_frame_off = (frame_sphere / 2) + body_frame_offset;
10 85
 
11 86
 module rail_lip(l) {
12 87
     hull() {
13
-        translate([-1, -0.1, 0])
88
+        translate([-1, -0.001, 0])
14 89
         cube([l + 2, 0.2, rail_lip_width_big]);
15
-        translate([-1, rail_lip_height - 0.1, (rail_lip_width_big - rail_lip_width_small) / 2])
16
-        cube([l + 2, 0.1, rail_lip_width_small]);
90
+        translate([-1, rail_lip_height - 0.001, (rail_lip_width_big - rail_lip_width_small) / 2])
91
+        cube([l + 2, 0.001, rail_lip_width_small]);
17 92
     }
18 93
 }
19 94
 
@@ -31,53 +106,80 @@ module rail(l) {
31 106
     }
32 107
 }
33 108
 
34
-laser_dia = 6.5;
35
-laser_len = 14.0;
109
+module rail_lock_internal(add = 0.0) {
110
+    if (add == 0) {
111
+        cube([rail_lock_width + add, rail_lock_depth + add, rail_lock_base_height + add], center = true);
112
+    
113
+        translate([(rail_lock_width + add + rail_lock_tab_width + add) / 2, 0, 0])
114
+        cube([rail_lock_tab_width + add, rail_lock_tab_depth + add, rail_lock_base_height + add], center = true);
115
+        
116
+        translate([-(rail_lock_width + add + rail_lock_tab_width + add) / 2, 0, 0])
117
+        cube([rail_lock_tab_width + add, rail_lock_tab_depth + add, rail_lock_base_height + add], center = true);
118
+    } else {
119
+        translate([0, 0, -rail_lock_travel / 2]) {
120
+            cube([rail_lock_width + add + 0.001, rail_lock_depth + add, rail_lock_base_height + add + rail_lock_travel + 0.001], center = true);
121
+        
122
+            translate([(rail_lock_width + add + rail_lock_tab_width + add) / 2, 0, 0])
123
+            cube([rail_lock_tab_width + add, rail_lock_tab_depth + add, rail_lock_base_height + add + rail_lock_travel], center = true);
124
+            
125
+            translate([-(rail_lock_width + add + rail_lock_tab_width + add) / 2, 0, 0])
126
+            cube([rail_lock_tab_width + add, rail_lock_tab_depth + add, rail_lock_base_height + add + rail_lock_travel], center = true);
127
+        }
128
+    }
129
+    
130
+    translate([0, 0, (rail_lock_base_height + add + rail_lock_pin_height + add) / 2])
131
+    cube([rail_lock_pin_width + add, rail_lock_pin_size + add, rail_lock_pin_height + add], center = true);
132
+}
133
+
134
+module rail_lock(add = 0.0) {
135
+    if (add == 0) {
136
+        difference() {
137
+            rail_lock_internal(add);
138
+            
139
+            translate([0, 0, -rail_lock_spring_hole - rail_lock_base_height / 2])
140
+            cylinder(d = rail_lock_spring_dia, h = rail_lock_spring_hole + 1);
141
+            
142
+            translate([0, -rail_lock_pin_size / 2, (rail_lock_base_height + add + rail_lock_pin_height + add) / 2 - -rail_lock_pin_size / 2])
143
+            rotate([45, 0, 0])
144
+            cube([rail_lock_pin_width + 2, rail_lock_pin_size, rail_lock_pin_height], center = true);
145
+        }
146
+    } else {
147
+        rail_lock_internal(add);
148
+    
149
+        translate([0, 0, -rail_lock_spring_hole - (rail_lock_base_height + add) / 2 - rail_lock_travel])
150
+        cylinder(d = rail_lock_spring_dia, h = rail_lock_spring_hole);
151
+    }
152
+}
36 153
 
37 154
 module laser() {
38 155
     cylinder(d = laser_dia, h = laser_len);
39 156
 }
40 157
 
41
-frame_gap = 0.2;
42
-frame_sphere = 20;
43
-frame_add_touch = 4.0;
44
-frame_wall = 1.5;
45
-frame_mount_hole = 2.0;
46
-frame_mid_len = frame_mount_hole + (2 * frame_wall);
47
-frame_mid_dia = laser_dia + (2 * frame_wall);
48
-frame_tail_len = 8.0;
49
-frame_tail_width = frame_mid_dia + 0.5;
50
-frame_negative_width = frame_sphere * 2 / 3 + 7;
51
-frame_hole_dia = 2.9;
52
-frame_hole_off = 1.8;
53
-frame_hole_neg_off = 10;
54
-frame_hole_neg_len = 15;
55
-frame_hole_neg_deg_a = 9;
56
-frame_hole_neg_deg_b = frame_hole_neg_deg_a;
57
-frame_hole_neg_rad_small = frame_mid_len + ((frame_sphere + frame_tail_len) / 2) - frame_hole_off;
58
-frame_hole_neg_rad_large = frame_mid_len + ((frame_sphere + frame_tail_len) / 2) + frame_hole_off;
59
-frame_len = frame_sphere + frame_mid_len + frame_tail_len;
60
-
61 158
 module laser_frame_screw_arc(radius, deg) {
62 159
     for (r = [-deg : 1 : deg])
63 160
     translate([radius, 0, 0])
64 161
     rotate([0, 0, r])
65 162
     translate([-radius, 0, 0])
66
-    cylinder(d = frame_hole_dia, h = frame_negative_width + frame_hole_neg_len);
163
+    cylinder(d = frame_hole_dia_arch, h = frame_negative_width + frame_hole_neg_len);
67 164
 }
68 165
 
69 166
 module laser_frame(added_gap = 0, negative = 0) {
70 167
     difference() {
71 168
         union() {
169
+            // top sphere
72 170
             translate([0, 0, (frame_sphere / 2) + (frame_len - frame_sphere)])
73 171
             sphere(d = frame_sphere + added_gap);
74 172
             
75 173
             if (negative == 0) {
174
+                // mid section
76 175
                 translate([0, 0, frame_len - frame_sphere - frame_mid_len - 0.5])
77 176
                 cylinder(d = frame_mid_dia + added_gap, h = frame_mid_len + frame_add_touch + 1.0);
78 177
                 
79
-                translate([-(frame_tail_width + added_gap) / 2, -(frame_tail_width + added_gap) / 2, frame_len - frame_sphere - frame_mid_len - frame_tail_len])
80
-                roundedcube([frame_tail_width + added_gap, frame_tail_width + added_gap, frame_tail_len]);
178
+                // bottom cube
179
+                translate([-(frame_tail_width + added_gap) / 2, -(frame_tail_width + added_gap) / 2, frame_len - frame_sphere - frame_mid_len - frame_tail_len]) {
180
+                    cube([frame_tail_width + added_gap, frame_tail_width + added_gap, frame_tail_len]);
181
+                    //roundedcube([frame_tail_width + added_gap, frame_tail_width + added_gap, frame_tail_len]);
182
+                }
81 183
             } else {
82 184
                 translate([0, 0, frame_len - frame_add_touch])
83 185
                 cylinder(d = laser_dia + added_gap, h = frame_mid_len + frame_add_touch);
@@ -96,21 +198,25 @@ module laser_frame(added_gap = 0, negative = 0) {
96 198
         }
97 199
         
98 200
         if (negative == 0) {
201
+            // cutout for laser itself
99 202
             translate([0, 0, -1])
100 203
             cylinder(d = laser_dia + (2 * frame_gap), h = frame_len + 2);
101 204
         
102
-            translate([0, 0, (frame_len - frame_sphere - frame_mid_len) + (frame_mid_len / 2)])
103
-            rotate([0, 90, 0]) {
104
-                cylinder(d = frame_mount_hole, h = frame_mid_dia);
205
+            // holding screws for laser
206
+            translate([0, 0, frame_len - (frame_mount_hole / 2) - frame_mount_hole_off])
207
+            rotate([0, 90, 45]) {
208
+                cylinder(d = frame_mount_hole, h = frame_sphere);
105 209
             
106 210
                 rotate([-90, 0, 0])
107
-                cylinder(d = frame_mount_hole, h = frame_mid_dia);
211
+                cylinder(d = frame_mount_hole, h = frame_sphere);
108 212
             }
109 213
             
214
+            // x-axis holes
110 215
             translate([-frame_tail_width / 2 - 1, 0, frame_len - frame_sphere - frame_mid_len - frame_tail_len + (frame_tail_len / 2) - frame_hole_off])
111 216
             rotate([0, 90, 0])
112 217
             cylinder(d = frame_hole_dia, h = frame_tail_width + 2);
113 218
             
219
+            // y-axis holes
114 220
             translate([0, -frame_tail_width / 2 - 1, frame_len - frame_sphere - frame_mid_len - frame_tail_len + (frame_tail_len / 2) + frame_hole_off])
115 221
             rotate([-90, 0, 0])
116 222
             cylinder(d = frame_hole_dia, h = frame_tail_width + 2);
@@ -118,55 +224,91 @@ module laser_frame(added_gap = 0, negative = 0) {
118 224
     }
119 225
 }
120 226
 
121
-body_width = 25.0;
122
-body_length = 45.0;
123
-body_height = 35.0;
124
-body_frame_gap = 0.5;
125
-body_frame_off = 15;
126
-body_cube_rounding = 1.0;
227
+module battery(add = 0.0) {
228
+    translate([-add / 2, -add / 2, -add / 2])
229
+    cube([bat_height + add, bat_width + add, bat_length + add]);
230
+}
127 231
 
128
-body_hole_dia = 2.2;
129
-body_hole_off_x = 2.2;
130
-body_hole_off_z = body_hole_off_x;
232
+module switch(add = 0.0) {
233
+    translate([(switch_length - (switch_length_body + add * 2)) / 2, -add, 0])
234
+    cube([(switch_length_body + add * 2), switch_width + add * 2, switch_height]);
235
+    
236
+    translate([(switch_length - switch_nub) / 2, (switch_width - switch_nub) / 2, switch_height])
237
+    cube([switch_nub, switch_nub, switch_nub]);
238
+    
239
+    translate([(switch_length - switch_length_body) / 4, switch_width / 2, 0]) {
240
+        cylinder(d = switch_hole_dia, h = switch_height + (switch_nub * 4));
241
+        translate([switch_hole_dist, 0, 0])
242
+        cylinder(d = switch_hole_dia, h = switch_height + (switch_nub * 4));
243
+    }
244
+}
131 245
 
132
-module body() {
246
+module body(hole_dia) {
133 247
     difference() {
134
-        //cube([body_length, body_width, body_height]);
135
-        roundedcube([body_length, body_width, body_height], false, body_cube_rounding);
248
+        // main body part
249
+        cube([body_length, body_width, body_height]);
250
+        //roundedcube([body_length, body_width, body_height], false, body_cube_rounding);
136 251
         
137
-        translate([-1, (body_width - rail_width) / 2, body_height - rail_height + 0.1])
252
+        // cutout for rail
253
+        translate([-1, (body_width - rail_width) / 2, body_height - rail_height + 0.001])
138 254
         rail(body_length + 2);
139 255
         
256
+        // cutout and preview for laser frame
140 257
         translate([body_length - frame_len, body_width / 2, body_frame_off])
141 258
         rotate([0, 90, 0]) {
142 259
             laser_frame(body_frame_gap, 1);
143 260
             %laser_frame();
144 261
         }
145 262
         
263
+        // cutout and preview for battery
264
+        translate([body_bat_off, (body_width - bat_width) / 2, (body_height - rail_height - bat_length) / 2]) {
265
+            battery(bat_case_add);
266
+            %battery();
267
+        }
268
+        
269
+        // cutout and preview for switch
270
+        translate([body_switch_off_x, body_width - switch_height + 0.001, body_height - rail_height - body_switch_off_y])
271
+        rotate([-90, 0, 0]) {
272
+            switch(body_switch_add);
273
+            %switch(0);
274
+            
275
+            // cutout for cabling
276
+            // TODO not very nice,
277
+            // with hardcoded values
278
+            translate([-0.001, -2.5, -8])
279
+            cube([18.5, 30, 9.5]);
280
+        }
281
+        
282
+        // cutout and preview for rail locking mechanism
283
+        translate([body_length - body_rail_lock_off_x, body_width / 2, rail_lock_base_height / 2 + body_height - rail_height - body_rail_lock_off_z])
284
+        rotate([0, 0, 90]) {
285
+            rail_lock(0.5);
286
+            %rail_lock();
287
+        }
288
+        
289
+        // outside screw holes
146 290
         translate([body_hole_off_x, -1, body_hole_off_z])
147 291
         rotate([-90, 0, 0])
148
-        cylinder(d = body_hole_dia, h = body_width + 2);
292
+        cylinder(d = hole_dia, h = body_width + 2);
149 293
         translate([body_length - body_hole_off_x, -1, body_hole_off_z])
150 294
         rotate([-90, 0, 0])
151
-        cylinder(d = body_hole_dia, h = body_width + 2);
295
+        cylinder(d = hole_dia, h = body_width + 2);
152 296
         translate([body_hole_off_x, -1, body_height - rail_height - body_hole_off_z])
153 297
         rotate([-90, 0, 0])
154
-        cylinder(d = body_hole_dia, h = body_width + 2);
298
+        cylinder(d = hole_dia, h = body_width + 2);
155 299
         translate([body_length - body_hole_off_x, -1, body_height - rail_height - body_hole_off_z])
156 300
         rotate([-90, 0, 0])
157
-        cylinder(d = body_hole_dia, h = body_width + 2);
158
-        
159
-        translate([-1, body_width / 2, body_height / 2.35])
160
-        rotate([0, 90, 0])
161
-        cylinder(d = 10, h = 20);
301
+        cylinder(d = hole_dia, h = body_width + 2);
162 302
     }
163 303
 }
164 304
 
165
-bodies_gap = 0.05;
166
-
167
-module body_half(half = 0) {
305
+module body_half(half) {
168 306
     difference() {
169
-        body();
307
+        if (half == 0) {
308
+            body(body_hole_dia_left);
309
+        } else {
310
+            body(body_hole_dia_right);
311
+        }
170 312
         
171 313
         if (half == 0) {
172 314
             translate([-1, (bodies_gap - body_width) / 2, -1])
@@ -190,13 +332,20 @@ module print() {
190 332
     
191 333
     translate([body_length + 10, body_height + 2, 0])
192 334
     laser_frame(0, 0);
335
+    
336
+    translate([body_length + 10, 20, rail_lock_base_height / 2])
337
+    rotate([0, 0, 90])
338
+    rail_lock(0);
339
+    
340
+    // simple brim
341
+    //translate([-10, -10, 0])
342
+    //cube([80, 95, 0.2]);
193 343
 }
194 344
 
195
-//laser_frame(0, 0);
196
-//laser_frame(0.5, 1);
345
+//laser_frame();
346
+rail_lock();
197 347
 
198 348
 //body_half(0);
199 349
 //body_half(1);
200
-//body();
201 350
 
202
-print();
351
+//print();

Loading…
Cancel
Save