|
| 1 | +include <../../variables.scad> |
| 2 | + |
| 3 | +use <../../lib/Round-Anything/polyround.scad> |
| 4 | +use <../../lib/utils.scad> |
| 5 | + |
| 6 | +module HandlebarRailRail() { |
| 7 | + mirrorCopy([1, 0, 0]) |
| 8 | + difference() { |
| 9 | + mirror([0, 1, 0]) |
| 10 | + rotate([90, 0, 0]) |
| 11 | + linear_extrude(HandlebarRail_rail_length, convexity=3) |
| 12 | + polygon([ |
| 13 | + [0, 0], |
| 14 | + [8, 0], |
| 15 | + [8, 7], |
| 16 | + [8 - 1.95, HandlebarRail_rail_total_height - 1.25 - 1.95 - 1.3], |
| 17 | + [8 - 1.95, HandlebarRail_rail_total_height - 1.95 - 1.3], |
| 18 | + [8, HandlebarRail_rail_total_height - 1.3], |
| 19 | + [8, HandlebarRail_rail_total_height], |
| 20 | + [0, HandlebarRail_rail_total_height], |
| 21 | + ]); |
| 22 | + |
| 23 | + translate([8-2, HandlebarRail_rail_length, -2]) |
| 24 | + rotate([0, 0, -45]) |
| 25 | + translate([-1, 0, 0]) |
| 26 | + cube([10, 10, 20]); |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +module HandlebarRailStopblock() { |
| 31 | + difference() { |
| 32 | + hull() { |
| 33 | + for(i=[-1,1])for(j=[0,1]) |
| 34 | + translate([i*(HandlebarRail_stopblock_width/2-HandlebarRail_stopblock_radius), j*(-HandlebarRail_stopblock_depth+2*HandlebarRail_stopblock_radius)-HandlebarRail_stopblock_radius, 0]) |
| 35 | + cylinder(r=HandlebarRail_stopblock_radius, h=HandlebarRail_stopblock_height); |
| 36 | + } |
| 37 | + |
| 38 | + // cutout for magnets |
| 39 | + translate([0, -HandlebarRail_stopblock_magnet_wall_thickness, 0]) { |
| 40 | + // hole for pushing magnet out |
| 41 | + translate([0, -HandlebarRail_stopblock_magnet_thickness*1.5, 0]) |
| 42 | + cylinder(d=HandlebarRail_stopblock_magnet_thickness, h=HandlebarRail_stopblock_height); |
| 43 | + |
| 44 | + translate([0, -HandlebarRail_stopblock_magnet_thickness, HandlebarRail_rail_total_height + HandlebarRail_stopblock_magnet_lift + HandlebarRail_stopblock_magnet_height / 2]) |
| 45 | + cube([HandlebarRail_stopblock_magnet_width, HandlebarRail_stopblock_magnet_thickness * 2, HandlebarRail_stopblock_magnet_height], center=true); |
| 46 | + |
| 47 | + #translate([0, -HandlebarRail_stopblock_magnet_thickness*1.5, HandlebarRail_stopblock_height-3+epsilon]) |
| 48 | + cube([HandlebarRail_stopblock_magnet_width, HandlebarRail_stopblock_magnet_thickness, 6], center=true); |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +module HandlebarRailZiptieCutout(width) { |
| 54 | + translate([0, width, 0]) |
| 55 | + rotate([90, 0, 0]) |
| 56 | + difference() { |
| 57 | + cylinder(r=HandlebarRail_tube_radius*1.3, h=width, $fn=$fn*2); |
| 58 | + cylinder(r=HandlebarRail_tube_radius*1.2, h=width, $fn=$fn*2); |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +module HandlebarRailOringCutout(r_torus=9.2,r_oring=1.7) { |
| 63 | + rotate_extrude()translate([r_torus,0,0])circle(r_oring); |
| 64 | + difference(){hull(){cylinder(h=epsilon,r=r_torus+r_oring); |
| 65 | + translate([0,5,10])cylinder(h=epsilon,r=r_torus+r_oring);} |
| 66 | + hull(){cylinder(h=epsilon,r=r_torus-r_oring); |
| 67 | + translate([0,5,10])cylinder(h=epsilon,r=r_torus-r_oring);}} |
| 68 | +} |
| 69 | + |
| 70 | +module HandlebarRail() { |
| 71 | + difference() { |
| 72 | + union() { |
| 73 | + HandlebarRailRail(); |
| 74 | + HandlebarRailStopblock(); |
| 75 | + } |
| 76 | + |
| 77 | + translate([0, 0, -HandlebarRail_tube_radius + HandlebarRail_tube_indent]) { |
| 78 | + union () { |
| 79 | + // tube |
| 80 | + translate([0, 50, 0]) |
| 81 | + rotate([90, 0, 0]) |
| 82 | + cylinder(r=HandlebarRail_tube_radius, h=100); |
| 83 | + #translate([7.6,HandlebarRail_rail_length/2,HandlebarRail_tube_radius - HandlebarRail_tube_indent+5]) |
| 84 | + rotate([0,10,0])HandlebarRailOringCutout(r_torus=6,r_oring=1.2); |
| 85 | + translate([-7.6,HandlebarRail_rail_length/2,HandlebarRail_tube_radius - HandlebarRail_tube_indent+5]) |
| 86 | + rotate([0,-10,0])HandlebarRailOringCutout(r_torus=6,r_oring=1.3); |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +if (orient_for_printing) { |
| 93 | + translate([0, 0, HandlebarRail_stopblock_depth]) |
| 94 | + rotate([90, 0, 0]) |
| 95 | + HandlebarRail(); |
| 96 | +} else { |
| 97 | + rotate([0, 0, 90]) |
| 98 | + HandlebarRail(); |
| 99 | +} |
0 commit comments