rearlight.scad: another iteration
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 26 Oct 2013 12:24:24 +0000 (14:24 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 28 Oct 2013 23:23:27 +0000 (00:23 +0100)
parts/rearlight.scad

index 938c381..2fd1868 100644 (file)
@@ -9,89 +9,6 @@ heatsink_thickness = 2.5;
 heatsink_width = 18-3.4;
 heatsink_length = 58;
 
-module fraen_lens_pin() {
-       cylinder(r=4/2, h=23, $fn=32);
-       translate([epsilon, 0, -5])
-               cylinder(r=3.4/2, h=5+epsilon);
-};
-
-module fraen_lens() {
-       cylinder(r1=6, r2=30.9/2, h=23);
-       assign(off=10.35) {
-       translate([off, off, 0])   fraen_lens_pin();
-       translate([off, -off, 0])  fraen_lens_pin();
-       translate([-off, off, 0])  fraen_lens_pin();
-       translate([-off, -off, 0]) fraen_lens_pin();
-       };
-};
-
-module heatsink() {
-       translate([-heatsink_length+ 5 +heatsink_width/2, -heatsink_width/2, 0])
-               cube([heatsink_length, heatsink_width, heatsink_thickness]);
-}
-
-module seat_holder() {
-       translate([-41, 8, 29])
-               cube([3, 30, 60], center=true);
-};
-
-module stem_ellipse(h, w, x, y) {
-       translate([x, y, 0])
-       difference() {
-               translate([0, 0, 6])
-                       scale([1, w/2, h-6])
-                               rotate([0, 90, 0])
-                                       cylinder(r=1, h=epsilon);
-               translate([0, 0, -100]) cube([200, 200, 200], center=true);
-       };
-}
-
-module main() {
-       difference() {
-               union() {
-                       hull() {
-                               cylinder(r=34/2, h=33);
-                               stem_ellipse(h = 15, w = 10, x = -21, y=-5);
-                       };
-                       hull() {
-                               stem_ellipse(h = 15, w = 10, x = -21-epsilon, y=-5);
-                               stem_ellipse(h = 15, w = 10, x = -33, y=-5);
-                       };
-                       hull() {
-                               stem_ellipse(h = 15, w = 10, x = -33-epsilon, y=-5);
-                               stem_ellipse(h = 25, w = 15, x = -40+epsilon, y=-2.5);
-                       };
-                       translate([-41, 5, 52/2])
-                               cube([7, 30, 52], center=true);
-                       // bolt hole ring
-                       translate([-44+epsilon, 10, 40]) rotate([0, -90, 0]) difference() {
-                               cylinder(r1=9, r2=6, h=3);
-                               translate([0, 0, -epsilon])
-                                       cylinder(r=5, h=3+2*epsilon, $fn=6);
-                       }
-                       // screw hole ring
-                       translate([-38-epsilon, 10, 40]) rotate([0, 90, 0]) difference() {
-                               cylinder(r1=9, r2=6, h=3);
-                               translate([0, 0, -epsilon])
-                                       cylinder(r=5, h=3+2*epsilon);
-                       }
-               };
-               translate([-47, 10, 40]) rotate([0, 90, 0])
-                       cylinder(r=2.5, h=12);
-               translate([0, 0, 6-heatsink_thickness])
-                       cylinder(r=31/2, h=32);
-               translate([0, 0, 6])
-                       fraen_lens();
-               heatsink();
-               seat_holder();
-       }
-       if (debug == 1) {
-               translate([0, 0, 6]) color("gray") fraen_lens();
-               color("lightblue") heatsink();
-               color("lightgreen") seat_holder();
-       }
-}
-
 module bolt_mount(d, h, w1, w2, fn) {
        difference() {
                translate([0, 0, -epsilon])
@@ -121,15 +38,6 @@ module clip_top_circle() {
        };
 };
 
-module clip_top() {
-       hull() {
-               translate([0, 0, clip_h1/2+clip_wall])
-                       clip_top_circle();
-               translate([0, clip_l-epsilon, clip_h2/2+clip_wall])
-                       clip_top_circle();
-       };
-};
-
 module seat_clip() {
        difference() {
                polyhedron(points = [
@@ -188,8 +96,6 @@ module seat_clip() {
        translate([clip_space, clip_bolt2_x, 0])
        rotate([0, 90, 0])
        bolt_mount(6, 3, 7, 14, 128);
-
-       clip_top();
 };
 
 /*
@@ -238,19 +144,29 @@ side_barrier_thickness = 2;
 module round_part() {
        difference() {
                cylinder(r = fraen_diam/2 + pin_diam/2 + wall_thickness,
-                       h = front_add + pin_len + wall_thickness);
-               translate([0, 0, -epsilon])
-                       cylinder(r = fraen_diam/2,
-                       h = pin_len + wall_thickness + front_add + 2*epsilon);
+                       h = front_add + pin_len);
+
+               hull() {
+                       translate([0, 0, -epsilon])
+                               cylinder(r = fraen_diam/2,
+                                       h = pin_len + front_add + 2*epsilon);
+                       for (angle = [0, 90, 180, 270]) {
+                               rotate([0, 0, angle+45])
+                                       translate([pin_offset, 0, -epsilon])
+                                               cylinder(r=pin_diam/2,
+                                                       h=epsilon, $fn=32);
+                       };
+               }
+
                // front cone
-               translate([0, 0, pin_len + 1.5*wall_thickness - epsilon])
+               translate([0, 0, pin_len + 0.5*wall_thickness - epsilon])
                        cylinder(r1 = fraen_diam/2,
                                r2 = (fraen_diam+pin_diam + wall_thickness)/2,
                                h = front_add + 2*epsilon);
                // pin holes
                for (angle = [0, 90, 180, 270]) {
                        rotate([0, 0, angle+45])
-                               translate([pin_offset, 0, wall_thickness-epsilon])
+                               translate([pin_offset, 0, epsilon])
                                        cylinder(r=pin_diam/2,
                                                h=pin_len+epsilon, $fn=32);
                };
@@ -270,22 +186,27 @@ module round_part() {
 module square_cone() {
        difference() {
                hull() {
-                       translate([0, 0, fraen_h - pin_len - wall_thickness])
+                       translate([0, 0, fraen_h - pin_len])
                                cylinder(r = fraen_diam/2 + pin_diam/2 + wall_thickness,
                                        h = epsilon);
                        for (angle = [0, 90, 180, 270])
                                rotate([0, 0, angle])
-                                       translate([9, 9, 0])
-                                               cylinder(r=wall_thickness+3.5/2, h = epsilon);
+                                       translate([9.1, 9.1, 0])
+                                               cylinder(r=wall_thickness+3.75/2, h = epsilon);
                }
                hull() {
-                       translate([0, 0, fraen_h - pin_len - wall_thickness+epsilon])
+                       translate([0, 0, fraen_h - pin_len + epsilon])
                                cylinder(r = fraen_diam/2,
                                        h = epsilon);
-                       for (angle = [0, 90, 180, 270])
-                               rotate([0, 0, angle])
-                                       translate([9, 9, -epsilon])
-                                               cylinder(r=3.5/2, h = epsilon);
+                       for (angle = [0, 90, 180, 270]) {
+                               rotate([0, 0, angle]) 
+                                       translate([9.1, 9.1, -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);
+                       }
                }
        }
 }
@@ -307,43 +228,57 @@ module rear_spring() {
 module heatsink_holder() {
        for (angle = [0, 180]) {
                rotate([0, 0, angle])
-                       translate([9+wall_thickness, 0, 6/2])
-                       cube([3.5/2+wall_thickness, 2*9-3.5-0.5, 6], center=true);
+                       translate([9.1+wall_thickness, 0, 6/2])
+                       cube([3.5/2+wall_thickness, 2*9.1-3.5-0.5, 6], center=true);
        }
 }
 
 module lens_holder() {
        difference() {
                union() {
-                       translate([0, 0, fraen_h - pin_len - wall_thickness])
+                       translate([0, 0, fraen_h - pin_len])
                                round_part();
                        square_cone();
                };
                
                // 0.5mm hole in the bottom
                // translate([side_barrier_x_offset-epsilon, -0.25, -epsilon])
-               translate([0, -0.25, (fraen_h - pin_len - wall_thickness)/2])
+               translate([0, -0.25, (fraen_h - pin_len)/2])
                        cube([infty, 0.5, infty]);
 
                // cable hole, 2*3mm
-               translate([9, 0, 6+3])
+               translate([9.1, 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);
        };
                
        rear_spring();
        heatsink_holder();
 };
 
-lens_holder($fn = 128);
+difference() {
+       union() {
+       lens_holder($fn = 128);
 
 translate([20, 40, 0])
        rotate([90, 0, -90])
                seat_clip(, $fn=128);
 
 hull() {
-       translate([0, 9+3.5/2+epsilon, wall_thickness/2])
-               cube([2*9+3.5, epsilon, wall_thickness], center=true);
+       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);
+};
+
+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);
 };
@@ -351,6 +286,14 @@ hull() {
 translate([7.5, 13.3, 0])
        cube([wall_thickness, 23, fraen_h - pin_len - wall_thickness]);
 
+       }
+/*
+       translate([-infty/2, -infty/2, 8])
+               cube(infty);
+*/
+};
+
+
        // vnitrni prumer kruhu by mel byt 30.75mm
        // vnejsi prumer aspon 35 mm
        // pin od stredu 10.35mm na x a y