rearlight.scad: first printed version
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 27 Oct 2013 09:25:24 +0000 (10:25 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 28 Oct 2013 23:23:27 +0000 (00:23 +0100)
BUGS:
- make rear spring a bit stronger
- wall_thickness could probably be lowered to 1.5mm
- fraen_h should be lowered about 0.5-1mm
- side barriers are too high
- clip_angle is too big - about 18 degrees should be enough

TO CHECK:
- bolt sizes
- side LED hole size
- cable hole

TODO:
we use elliptical beam lens, so for two lenses it could make sense
to not have the clip and lens axis parallel, but instead to make
it shine more to the side.

parts/rearlight.scad

index 2c8e7a9..ecc53dd 100644 (file)
@@ -13,11 +13,14 @@ pin_offset = 10.35*1.4142;
 pin_len = 9.2;
 front_add = 4;
 
+rear_pin_dist = 9.1;
+rear_pin_diam = 3.25;
+
 side_barrier_x_offset = 13;
 side_barrier_pin_z_offset = 4.2;
 side_barrier_thickness = 2;
 
-heatsink_thickness = 2.5;
+heatsink_thickness = 2;
 
 clip_h1 = 27; // front height (on the heatsink side)
 clip_h2 = 20; // rear height (on the lens side)
@@ -113,7 +116,7 @@ module round_part() {
                                rotate([0, 0, angle+45])
                                        translate([pin_offset, 0, -epsilon])
                                                cylinder(r=pin_diam/2,
-                                                       h=epsilon, $fn=32);
+                                                       h=epsilon);
                        };
                }
 
@@ -127,7 +130,7 @@ module round_part() {
                        rotate([0, 0, angle+45])
                                translate([pin_offset, 0, epsilon])
                                        cylinder(r=pin_diam/2,
-                                               h=pin_len+epsilon, $fn=32);
+                                               h=pin_len+epsilon);
                };
        };
 
@@ -150,7 +153,7 @@ module square_cone() {
                                        h = epsilon);
                        for (angle = [0, 90, 180, 270])
                                rotate([0, 0, angle])
-                                       translate([9.1, 9.1, 0])
+                                       translate([rear_pin_dist, rear_pin_dist, 0])
                                                cylinder(r=wall_thickness+3.75/2, h = epsilon);
                }
                hull() {
@@ -159,36 +162,52 @@ module square_cone() {
                                        h = epsilon);
                        for (angle = [0, 90, 180, 270]) {
                                rotate([0, 0, angle]) 
-                                       translate([9.1, 9.1, -epsilon])
+                                       translate([rear_pin_dist, rear_pin_dist, -epsilon])
                                                cylinder(r=3.75/2, h = epsilon);
                                rotate([0, 0, angle+45])
                                        translate([pin_offset, 0, fraen_h - pin_len + epsilon])
                                                cylinder(r=pin_diam/2,
-                                                       h=epsilon, $fn=32);
+                                                       h=epsilon);
                        }
                }
        }
 }
 
-rear_spring_w = 4;
+rear_spring_w = 2*rear_pin_dist-rear_pin_diam-0.5;
+rear_spring_h = 1;
+rear_spring_center_w = 4;
+led_zoff = 6;
 
 module rear_spring() {
        translate([0, 0, wall_thickness/2])
-               cube([18+2*wall_thickness+3.5, rear_spring_w, wall_thickness], center=true);
-       difference() {
-               rotate([90, 0, 0])
-                       translate([0, 0, -rear_spring_w/2])
-                       cylinder(r=6-heatsink_thickness, h = rear_spring_w);
-               translate([0, 0, -infty/2+epsilon])
-                       cube(infty, center=true);
-       };
-};
+               cube([rear_spring_center_w, rear_spring_w, wall_thickness],
+                       center=true);
+       translate([0, rear_spring_w/2-wall_thickness/2,
+               (led_zoff-heatsink_thickness)/2])
+               cube([rear_spring_center_w,
+                       wall_thickness, led_zoff-heatsink_thickness],
+                       center=true);
+       translate([0, -rear_spring_w/2+wall_thickness/2,
+               (led_zoff-heatsink_thickness)/2])
+               cube([rear_spring_center_w,
+                       wall_thickness, led_zoff-heatsink_thickness],
+                       center=true);
+
+       for (angle=[0, 180]) {
+               rotate([0, 0, angle])
+               translate([5.5, 0, rear_spring_h/2])
+                       rotate([0, 0, 45]) {
+                               cube([wall_thickness, 14, rear_spring_h],
+                                       center=true);
+               }
+       }
+}
 
 module heatsink_holder() {
        for (angle = [0, 180]) {
                rotate([0, 0, angle])
-                       translate([9.1+wall_thickness, 0, 6/2])
-                       cube([3.5/2+wall_thickness, 2*9.1-3.5-0.5, 6], center=true);
+                       translate([rear_pin_dist+wall_thickness, 0, led_zoff/2])
+                       cube([rear_pin_diam/2+wall_thickness, 2*rear_pin_dist-rear_pin_diam-0.5, led_zoff], center=true);
        }
 }
 
@@ -206,49 +225,123 @@ module lens_holder() {
                        cube([infty, 0.5, infty]);
 
                // cable hole, 2*3mm
-               translate([9.1, 0, 6+3])
+               translate([rear_pin_dist, 0, 6+3])
                        rotate([0, 0, 60])
                                cube([infty, 2, 3]);
 
                // side LED hole, 3mm
                translate([0, 0, fraen_h - pin_len])
                        rotate([90, 0, 0])
-                               cylinder(r=3.5/2, h=infty, $fn=6);
+                               cylinder(r=rear_pin_diam/2, h=infty, $fn=6);
        };
                
        rear_spring();
        heatsink_holder();
 };
 
-union() {
-       lens_holder($fn = 128);
-       translate([clip_x_off, clip_y_off, 0])
-               seat_clip();
-/*
-hull() {
-       translate([0, 9.1+3.5/2+epsilon, wall_thickness/2])
-               cube([9.1, epsilon, wall_thickness], center=true);
-       translate([20-clip_wall/2, 40-clip_space/2-clip_wall+epsilon, wall_thickness/2])
-               cube([9.1, epsilon/2, wall_thickness], center=true);
-};
+module xy_joint() {
+       hull() {
+               intersection() {
+                       lens_holder();
+                       translate([-infty-0.5*rear_pin_dist,
+                               rear_pin_dist+rear_pin_diam/2+0.35*wall_thickness,
+                               0])
+                               cube([infty, infty, clip_wall]);
+               };
+
+               translate([clip_x_off, clip_y_off, 0])
+                       intersection() {
+                               seat_clip();
+                               translate([-infty+clip_wall+0.20*clip_h1, -infty-clip_space, 0])
+                                       cube([infty, infty, clip_wall]);
+                       };
+       };
+       hull() {
+               intersection() {
+                       lens_holder();
+                       translate([0.5*rear_pin_dist,
+                               rear_pin_dist+rear_pin_diam/2+0.35*wall_thickness,
+                               0])
+                               cube([infty, infty, clip_wall]);
+               };
 
-hull() {
-       translate([0, 9.1+3.5/2+epsilon, wall_thickness/2])
-               cube([2*.259+3.5, epsilon, wall_thickness], center=true);
-       translate([20-clip_wall/2, 40-clip_space/2-clip_wall+epsilon, wall_thickness/2])
-               cube([clip_h1+clip_wall, epsilon/2, wall_thickness], center=true);
+               translate([clip_x_off, clip_y_off, 0])
+                       intersection() {
+                               seat_clip();
+                               translate([0.8*clip_h1-clip_wall, -infty-clip_space, 0])
+                                       cube([infty, infty, clip_wall]);
+                       };
+       };
 };
 
-translate([7.5, 13.3, 0])
-       cube([wall_thickness, 23, fraen_h - pin_len - wall_thickness]);
+module yz_joint() {
+       difference() {
+               hull() {
+                       translate([clip_x_off, clip_y_off, 0])
+                               intersection() {
+                                       seat_clip();
+                                       translate([-1.5*clip_wall+(fraen_h-pin_len)*tan(clip_angle), -clip_space/2-clip_wall+epsilon, 0])
+                                       cube([clip_wall, epsilon, fraen_h - pin_len]);
+                               };
+                       translate([clip_x_off - 1.5*clip_wall+(fraen_h-pin_len)*tan(clip_angle), 0, 0])
+                  
+                               cube([clip_wall, epsilon, (fraen_h - pin_len)]);
+               };
+               hull() {
+                       translate([0, 0, fraen_h - pin_len + epsilon])
+                               cylinder(r = fraen_diam/2 + pin_diam/2 + wall_thickness/2,
+                                       h = epsilon);
+                       for (angle = [0, 90, 180, 270])
+                               rotate([0, 0, angle])
+                                       translate([rear_pin_dist, rear_pin_dist, -epsilon])
+                                               cylinder(r=wall_thickness/2+3.75/2, h = epsilon);
+               };
+       };
+};
 
+module full_joint() {
+       difference() {
+               hull() {
+                               intersection() {
+                                       rotate([-90, 0, 0])
+                                       scale([0.30, 1, 1])
+                                               cylinder(r = fraen_h-pin_len, h = rear_pin_dist + wall_thickness+rear_pin_diam/2);
+                                       translate([-infty/2, rear_pin_dist + wall_thickness + rear_pin_diam/2 - epsilon, 0])
+                                               cube(infty);
+                               };
+                       translate([clip_x_off, clip_y_off, 0])
+                               intersection() {
+                                       seat_clip();
+                                       translate([(fraen_h-pin_len)*tan(clip_angle)-clip_wall, -clip_space/2-clip_wall+epsilon, 0])
+                                               rotate([90, 0, 0])
+                                               scale([0.45, 1, 1])
+                                                       cylinder(r = fraen_h-pin_len, h = epsilon);
+                               };
+               };
+               hull() {
+                       translate([0, 0, fraen_h - pin_len + epsilon])
+                               cylinder(r = fraen_diam/2 + pin_diam/2 + wall_thickness/2,
+                                       h = epsilon);
+                       for (angle = [0, 90, 180, 270])
+                               rotate([0, 0, angle])
+                                       translate([rear_pin_dist, rear_pin_dist, -epsilon])
+                                               cylinder(r=wall_thickness/2+3.75/2, h = epsilon);
+               };
        }
-       //translate([-infty/2, -infty/2, 8])
-       //      cube(infty);
-*/
+};
+
+module main() {
+       lens_holder();
+       translate([clip_x_off, clip_y_off, 0])
+               seat_clip();
+       // xy_joint();
+       // yz_joint();
+       full_joint();
 };
 
 
+scale([1, -1, 1]) main($fn=128);
+// main($fn = 128);
        // vnitrni prumer kruhu by mel byt 30.75mm
        // vnejsi prumer aspon 35 mm
        // pin od stredu 10.35mm na x a y