From: Jan "Yenya" Kasprzak Date: Fri, 18 Oct 2013 06:46:25 +0000 (+0200) Subject: rearlight.scad: rear light holder for AZUB X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=16918ca0a912dc0daf3a087ff25ea4ab8ffc30f0;p=bike-lights.git rearlight.scad: rear light holder for AZUB --- diff --git a/parts/rearlight.scad b/parts/rearlight.scad new file mode 100644 index 0000000..00a3cf6 --- /dev/null +++ b/parts/rearlight.scad @@ -0,0 +1,230 @@ +// Holder for Fraen FHS-HEB1-LB01-x lens for Luxeon LEDs. +// I use it for my rear lights. + +epsilon = 0.01; +infty = 100; +debug = 0; + +heatsink_thickness = 2.5; +heatsink_width = 18-3.4; +heatsink_length = 58; + +module fraen_lens_pin() { + cylinder(r1=2, r2=6.15/2, h=23); + translate([epsilon, 0, -5]) + cylinder(r=3.4/2, h=5+epsilon); +}; + +module fraen_lens() { + cylinder(r1=6, r2=30.51/2, h=23); + translate([9, 9, 0]) fraen_lens_pin(); + translate([9, -9, 0]) fraen_lens_pin(); + translate([-9, 9, 0]) fraen_lens_pin(); + translate([-9, -9, 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]) + cylinder(r1=w2/2, r2=w1/2, h=h+epsilon); + translate([0, 0, -2*epsilon]) + cylinder(r=d/2, h=h+3*epsilon, $fn=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 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 = [ + [-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=1.5, h=2*clip_wall+clip_space+2*epsilon); + translate([0, clip_bolt2_x, 0]) + rotate([0, 90, 0]) + translate([0, 0, -clip_wall-clip_space/2-epsilon]) + cylinder(r=1.5, h=2*clip_wall+clip_space+2*epsilon); + }; + + 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); + + translate([clip_space, clip_bolt1_x, 0]) + rotate([0, 90, 0]) + bolt_mount(6, 3, 7, 14, 128); + + translate([clip_space, clip_bolt2_x, 0]) + rotate([0, 90, 0]) + bolt_mount(6, 3, 7, 14, 128); + + clip_top(); +}; + +seat_clip(); + +difference() { + union() { + hull() { + translate([40, epsilon, 2]) + clip_top(); + clip_top(); + }; + + translate([40, 0, 25]) + rotate([-90, 0, 0]) + cylinder(r=34/2, h=clip_l); + + 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(); + }; +}; + +/* +if (debug == 1) { + difference() { + main($fn=64); + //translate([0, -100, 0]) cube([200, 200, 200], center=true); + rotate([0, 0, 40])translate([0, -100, 0]) cube([200, 200, 200], center=true); + }; +} else { + main($fn=128); +} +*/