rearlight.scad: new holder, not yet connected to the main object
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 26 Oct 2013 15:37:48 +0000 (17:37 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 28 Oct 2013 23:23:27 +0000 (00:23 +0100)
parts/rearlight.scad

index 2fd1868..2c8e7a9 100644 (file)
@@ -5,10 +5,36 @@ epsilon = 0.01;
 infty = 100;
 debug = 0;
 
+wall_thickness = 2;
+fraen_diam = 30.75;
+fraen_h = 29.8;
+pin_diam = 4;
+pin_offset = 10.35*1.4142;
+pin_len = 9.2;
+front_add = 4;
+
+side_barrier_x_offset = 13;
+side_barrier_pin_z_offset = 4.2;
+side_barrier_thickness = 2;
+
 heatsink_thickness = 2.5;
-heatsink_width = 18-3.4;
-heatsink_length = 58;
 
+clip_h1 = 27; // front height (on the heatsink side)
+clip_h2 = 20; // rear height (on the lens side)
+clip_l  = 28;
+clip_wall = wall_thickness;
+clip_space = 3.5;
+clip_bolt1_z = 6;
+clip_bolt1_x = 20;
+clip_bolt2_z = 22;
+clip_bolt2_x = 23;
+clip_angle = 24;
+clip_top_xoff = clip_l*tan(clip_angle);
+
+clip_y_off = 37;
+clip_x_off = 0;
+
+// z-axis is up
 module bolt_mount(d, h, w1, w2, fn) {
        difference() {
                translate([0, 0, -epsilon])
@@ -18,129 +44,62 @@ module bolt_mount(d, h, w1, w2, fn) {
        };
 };
 
-clip_h1 = 25; // inner height
-clip_h2 = 18; // inner height
-clip_l  = 35;
-clip_wall = 2;
-clip_space = 4;
-clip_bolt1_x = 10;
-clip_bolt2_x = 25;
-
-module clip_top_circle() {
-       rotate([-90, 0, 0])
-       difference() {
-               translate([-clip_space/2, 0, 0])
-                       cylinder(r=clip_wall, h = epsilon, $fn=32);
-               translate([-infty/2, clip_wall/2-epsilon, -epsilon])
-                       cube(infty);
-               translate([clip_wall+epsilon, -infty/2, -epsilon])
-                       cube(infty);
-       };
-};
-
 module seat_clip() {
        difference() {
-               polyhedron(points = [
-                       [-clip_wall-clip_space/2, 0, clip_h1/2+clip_wall],
-                       [-clip_wall-clip_space/2, clip_l, clip_h2/2+clip_wall],
-                       [-clip_wall-clip_space/2, clip_l, -clip_h2/2],
-                       [-clip_wall-clip_space/2, 0, -clip_h1/2],
-                       [ clip_wall+clip_space/2,  0, clip_h1/2+clip_wall],
-                       [ clip_wall+clip_space/2, clip_l, clip_h2/2+clip_wall],
-                       [ clip_wall+clip_space/2, clip_l, -clip_h2/2],
-                       [ clip_wall+clip_space/2, 0, -clip_h1/2],
-               ], triangles = [
-                       [0, 2, 1], [3, 2, 0], [4, 5, 6], [6, 7, 4],
-                       [0, 1, 5], [5, 4, 0], [2, 3, 7], [7, 6, 2],
-                       [1, 2, 6], [6, 5, 1], [0, 7, 3], [7, 0, 4],
-               ]);
-               polyhedron(points = [
-                       [-clip_space/2, -epsilon, clip_h1/2],
-                       [-clip_space/2, clip_l+epsilon, clip_h2/2],
-                       [-clip_space/2, clip_l+epsilon, -clip_h2/2-epsilon],
-                       [-clip_space/2, -epsilon, -clip_h1/2-epsilon],
-                       [ clip_space/2, -epsilon, clip_h1/2],
-                       [ clip_space/2, clip_l+epsilon, clip_h2/2],
-                       [ clip_space/2, clip_l+epsilon, -clip_h2/2-epsilon],
-                       [ clip_space/2, -epsilon, -clip_h1/2-epsilon],
-               ], triangles = [
-                       [0, 2, 1], [3, 2, 0], [4, 5, 6], [6, 7, 4],
-                       [0, 1, 5], [5, 4, 0], [2, 3, 7], [7, 6, 2],
-                       [1, 2, 6], [6, 5, 1], [0, 7, 3], [7, 0, 4],
-               ]);
-               // bolt holes
-               translate([0, clip_bolt1_x, 0])
-                       rotate([0, 90, 0])
-                       translate([0, 0, -clip_wall-clip_space/2-epsilon])
-                       cylinder(r=2, h=2*clip_wall+clip_space+2*epsilon,
-                               $fn = 6);
-               translate([0, clip_bolt2_x, 0])
-                       rotate([0, 90, 0])
-                       translate([0, 0, -clip_wall-clip_space/2-epsilon])
-                       cylinder(r=2, h=2*clip_wall+clip_space+2*epsilon,
-                               $fn=6);
-       };
-
-       translate([-clip_space, clip_bolt1_x, 0])
-       rotate([0, -90, 0])
-       bolt_mount(6, 3, 7, 14, 6);
-
-       translate([-clip_space, clip_bolt2_x, 0])
-       rotate([0, -90, 0])
-       bolt_mount(6, 3, 7, 14, 6);
+               union() {
+                       // right part
+                       hull() {
+                               translate([0, clip_space/2, 0])
+                                       cube([clip_h1, clip_wall, epsilon]);
+                               translate([clip_top_xoff, clip_space/2, clip_l])
+                                       cube([clip_h2, clip_wall, epsilon]);
+                       };
 
-       translate([clip_space, clip_bolt1_x, 0])
-       rotate([0, 90, 0])
-       bolt_mount(6, 3, 7, 14, 128);
+                       // left part
+                       hull() {
+                               translate([0, -clip_space/2-clip_wall, 0])
+                                       cube([clip_h1, clip_wall, epsilon]);
+                               translate([0+clip_top_xoff, -clip_space/2-clip_wall, clip_l])
+                                       cube([clip_h2, clip_wall, epsilon]);
+                       };
 
-       translate([clip_space, clip_bolt2_x, 0])
-       rotate([0, 90, 0])
-       bolt_mount(6, 3, 7, 14, 128);
-};
+                       // top part
+                       hull() {
+                               translate([-clip_wall, -clip_space/2-clip_wall, 0])
+                                       cube([clip_wall+epsilon, 2*clip_wall+clip_space, epsilon]);
+                               translate([-clip_wall+clip_top_xoff, -clip_space/2-clip_wall, clip_l])
+                                       cube([clip_wall+epsilon, 2*clip_wall+clip_space, epsilon]);
+                       };
 
-/*
-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);
 
-difference() {
-       union() {
-               hull() {
-                       translate([40, epsilon, 2])
-                               clip_top();
-                       clip_top();
-               };
+                       translate([clip_bolt1_x, -clip_space/2 - clip_wall, clip_bolt1_z])
+                       rotate([90, 0, 0])
+                       bolt_mount(6.5, 2, 7, 12, 6);
 
-               translate([40, 0, 25])
+                       translate([clip_bolt2_x, clip_space/2 + clip_wall, clip_bolt2_z])
                        rotate([-90, 0, 0])
-                               cylinder(r=34/2, h=clip_l);
+                       bolt_mount(6.5, 2, 7, 12, 32);
 
-               hull() {
-                       translate([clip_space/2+epsilon, 0, 0])
-                               cube([clip_wall-epsilon, clip_wall, clip_h1/2+2*clip_wall-epsilon]);
-                       translate([40, 0, 14+epsilon])
-                               cube([clip_wall-epsilon, clip_wall, 34/2]);
-               };
-       };
-       translate([40, 6, 25])
-               rotate([-90, 0, 0]) {
-                       cylinder(r=31/2, h=clip_l);
-                       fraen_lens();
-                       heatsink();
+                       translate([clip_bolt2_x, -clip_space/2 - clip_wall, clip_bolt2_z])
+                       rotate([90, 0, 0])
+                       bolt_mount(6.5, 2, 7, 12, 6);
                };
-};
-*/
-
-wall_thickness = 1.5;
-fraen_diam = 30.75;
-fraen_h = 29.8;
-pin_diam = 4;
-pin_offset = 10.35*1.4142;
-pin_len = 9.2;
-front_add = 4;
+               // bolt holes
+               translate([clip_bolt1_x, infty/2, clip_bolt1_z])
+                       rotate([90, 0, 0])
+                       cylinder(r=2, h=infty, $fn = 6);
+               translate([clip_bolt2_x, infty/2, clip_bolt2_z])
+                       rotate([90, 0, 0])
+                       cylinder(r=2, h=infty, $fn = 6);
+       }
 
-side_barrier_x_offset = 13;
-side_barrier_pin_z_offset = 4.2;
-side_barrier_thickness = 2;
+}
 
+// upper part of the lens holder
 module round_part() {
        difference() {
                cylinder(r = fraen_diam/2 + pin_diam/2 + wall_thickness,
@@ -162,7 +121,7 @@ module round_part() {
                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);
+                               h = front_add - 0.5*wall_thickness+ 2*epsilon);
                // pin holes
                for (angle = [0, 90, 180, 270]) {
                        rotate([0, 0, angle+45])
@@ -261,14 +220,11 @@ module lens_holder() {
        heatsink_holder();
 };
 
-difference() {
-       union() {
+union() {
        lens_holder($fn = 128);
-
-translate([20, 40, 0])
-       rotate([90, 0, -90])
-               seat_clip(, $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);
@@ -287,9 +243,8 @@ translate([7.5, 13.3, 0])
        cube([wall_thickness, 23, fraen_h - pin_len - wall_thickness]);
 
        }
-/*
-       translate([-infty/2, -infty/2, 8])
-               cube(infty);
+       //translate([-infty/2, -infty/2, 8])
+       //      cube(infty);
 */
 };