]> www.fi.muni.cz Git - bike-lights.git/commitdiff
Speedometer illumination
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Thu, 17 Sep 2015 13:53:42 +0000 (15:53 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Thu, 17 Sep 2015 13:53:42 +0000 (15:53 +0200)
parts/speedometer.scad [new file with mode: 0644]

diff --git a/parts/speedometer.scad b/parts/speedometer.scad
new file mode 100644 (file)
index 0000000..df0801a
--- /dev/null
@@ -0,0 +1,99 @@
+infty = 200;
+eps = 0.05;
+
+tube_d = 31.8;
+tube_d1 = 28;
+body_w = 10;
+body_h = 30;
+
+wall = 2;
+
+led_d = 3 + 0.5;
+
+zip_w = 3.5;
+zip_h = 2.5;
+
+top_w = 6+2*wall;
+top_led_h = body_h-9;
+
+cable_w = 6;
+cable_h = 3;
+
+module body() {
+       hull() {
+               cylinder(r = tube_d/2 + wall, h = body_w);
+               translate([body_h + tube_d/2, 0, 0])
+                       scale([0.75, 1, 1])
+                       cylinder(r = top_w/2, h = body_w);
+       }
+}
+
+module chamber() {
+/*
+       intersection() {
+               hull() {
+                       translate([0, -tube_d/2, wall])
+                               cube([eps, infty, infty]);
+                       translate([tube_d/2+body_h-eps, -top_w/2+wall, wall])
+                               cube([eps, infty, infty]);
+               }
+               translate([tube_d/2 + 2*wall, -tube_d/2, 0])
+                       cube([body_h-3*wall-5, tube_d+2*wall, body_w+eps]);
+       }
+*/
+       difference() {
+               hull() {
+                       translate([0, 0, wall])
+                               cylinder(r = tube_d/2, h = body_w);
+                       translate([tube_d/2+body_h-eps, 0, wall])
+                               scale([0.75, 1, 1])
+                               cylinder(r = top_w/2-wall, h = body_w);
+               }
+               // bottom part
+               translate([0, -tube_d/2-wall-eps, 0])
+                       cube([tube_d/2+wall+zip_h/2, tube_d+2*wall, body_w+2*wall]);
+               // top covered part
+               translate([top_led_h + tube_d/2, -tube_d/2, body_w-wall])
+                       cube([infty, tube_d, 2*wall]);
+               // wall with hole for LED
+               translate([top_led_h + tube_d/2, 1, wall])
+                       cube([wall, infty, infty]);
+       }
+}
+
+module holder() {
+       difference() {
+               body();
+               // cut off the bottom part
+               translate([-infty+tube_d/4, -infty/2, -infty/2]) cube(infty);
+               // main tube
+               translate([0, 0, -eps])
+                       cylinder(r1 = tube_d1/2, r2 = tube_d/2, h = body_w + 2*eps);
+               // zip tie hole
+               scale([1, 1.05, 1])
+               translate([0, 0, body_w/2 - zip_w/2])
+                       rotate_extrude(convexity = 10) {
+                               translate([tube_d/2 + wall, 0, 0])
+                               square(size = [zip_h, zip_w]);
+                       }
+               chamber();
+               // front hole
+               translate([tube_d/2 + wall + zip_h/2, 0, wall])
+                       cube([top_led_h - wall - zip_h/2, tube_d, body_h]);
+               // LED hole
+               translate([tube_d/2+top_led_h+2*wall,1.5*wall, body_w/2-0.5])
+                       rotate([-15, -65, 0])
+                       cylinder(r = led_d/2, h = 10);
+               // cable hole
+               hull() {
+                       translate([tube_d/2 + wall + zip_h/2, -10,
+                               body_w/2-zip_w/2])
+                               cube([cable_h, cable_w, eps]);
+                       translate([tube_d/2, -10, -eps])
+                               cube([cable_h, cable_w, eps]);
+               }
+       }
+}
+
+holder();
+