rearlight.scad: printed - hopefully final - version
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 28 Oct 2013 23:22:38 +0000 (00:22 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 28 Oct 2013 23:23:27 +0000 (00:23 +0100)
parts/rearlight.scad

index ecc53dd..26aa5e3 100644 (file)
@@ -5,9 +5,9 @@ epsilon = 0.01;
 infty = 100;
 debug = 0;
 
-wall_thickness = 2;
-fraen_diam = 30.75;
-fraen_h = 29.8;
+wall_thickness = 1.5;
+fraen_diam = 30.90;
+fraen_h = 29.3;
 pin_diam = 4;
 pin_offset = 10.35*1.4142;
 pin_len = 9.2;
@@ -28,14 +28,15 @@ clip_l  = 28;
 clip_wall = wall_thickness;
 clip_space = 3.5;
 clip_bolt1_z = 6;
-clip_bolt1_x = 20;
+clip_bolt1_x = 19.5;
 clip_bolt2_z = 22;
-clip_bolt2_x = 23;
-clip_angle = 24;
+clip_bolt2_x = 21;
+clip_angle = 18;
 clip_top_xoff = clip_l*tan(clip_angle);
 
-clip_y_off = 37;
-clip_x_off = 0;
+clip_y_off = 34;
+clip_x_off = 2;
+clip_x_rot = -3;
 
 // z-axis is up
 module bolt_mount(d, h, w1, w2, fn) {
@@ -77,19 +78,19 @@ module seat_clip() {
                        // bolt mounts
                        translate([clip_bolt1_x, clip_space/2 + clip_wall, clip_bolt1_z])
                        rotate([-90, 0, 0])
-                       bolt_mount(6.5, 2, 7, 12, 32);
+                       bolt_mount(6.5, 2, 7, 12, 6);
 
                        translate([clip_bolt1_x, -clip_space/2 - clip_wall, clip_bolt1_z])
                        rotate([90, 0, 0])
-                       bolt_mount(6.5, 2, 7, 12, 6);
+                       bolt_mount(6.5, 2, 7, 12, 32);
 
                        translate([clip_bolt2_x, clip_space/2 + clip_wall, clip_bolt2_z])
                        rotate([-90, 0, 0])
-                       bolt_mount(6.5, 2, 7, 12, 32);
+                       bolt_mount(6.5, 2, 7, 12, 6);
 
                        translate([clip_bolt2_x, -clip_space/2 - clip_wall, clip_bolt2_z])
                        rotate([90, 0, 0])
-                       bolt_mount(6.5, 2, 7, 12, 6);
+                       bolt_mount(6.5, 2, 7, 12, 32);
                };
                // bolt holes
                translate([clip_bolt1_x, infty/2, clip_bolt1_z])
@@ -140,7 +141,7 @@ module round_part() {
                        intersection() {
                                cylinder(r=fraen_diam/2+epsilon, h=infty);
                                translate([-infty/2, side_barrier_x_offset,
-                                       wall_thickness + pin_len - side_barrier_pin_z_offset - side_barrier_thickness ])
+                                       pin_len - side_barrier_pin_z_offset - side_barrier_thickness ])
                                        cube([infty, infty, side_barrier_thickness]);
                };
 };
@@ -173,8 +174,8 @@ module square_cone() {
        }
 }
 
-rear_spring_w = 2*rear_pin_dist-rear_pin_diam-0.5;
-rear_spring_h = 1;
+rear_spring_w = 2*rear_pin_dist-rear_pin_diam-2;
+rear_spring_h = 1.5;
 rear_spring_center_w = 4;
 led_zoff = 6;
 
@@ -206,8 +207,8 @@ module rear_spring() {
 module heatsink_holder() {
        for (angle = [0, 180]) {
                rotate([0, 0, angle])
-                       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);
+                       translate([rear_pin_dist+wall_thickness, 0, (led_zoff+wall_thickness)/2])
+                       cube([rear_pin_diam/2+wall_thickness, 2*rear_pin_dist-rear_pin_diam-2, led_zoff+wall_thickness], center=true);
        }
 }
 
@@ -239,81 +240,21 @@ module lens_holder() {
        heatsink_holder();
 };
 
-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]);
-               };
-
-               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]);
-                       };
-       };
-};
-
-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])
+                                       scale([0.25, 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();
+                                       seat_clip_rotated();
                                        translate([(fraen_h-pin_len)*tan(clip_angle)-clip_wall, -clip_space/2-clip_wall+epsilon, 0])
-                                               rotate([90, 0, 0])
+                                               rotate([90+clip_x_rot, 0, 0])
                                                scale([0.45, 1, 1])
                                                        cylinder(r = fraen_h-pin_len, h = epsilon);
                                };
@@ -330,18 +271,29 @@ module full_joint() {
        }
 };
 
+module seat_clip_rotated() {
+       difference() {
+               translate([clip_space/2+clip_wall, 0, 0])
+               rotate([clip_x_rot, 0, 0])
+               translate([-clip_space/2-clip_wall, 0, sin(clip_x_rot)*(clip_space/2+clip_wall+epsilon)])
+                       seat_clip();
+               translate([-infty/2, -infty/2, -infty])
+                       cube(infty);
+       };
+};
+                       
 module main() {
        lens_holder();
        translate([clip_x_off, clip_y_off, 0])
-               seat_clip();
+               seat_clip_rotated();
        // xy_joint();
        // yz_joint();
        full_joint();
 };
 
 
-scale([1, -1, 1]) main($fn=128);
-// main($fn = 128);
+// 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