speedometer.scad: second printed version master
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 21 Sep 2015 15:18:55 +0000 (17:18 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 21 Sep 2015 15:18:55 +0000 (17:18 +0200)
parts/speedometer.scad

index df0801a..92e78d2 100644 (file)
@@ -2,19 +2,22 @@ infty = 200;
 eps = 0.05;
 
 tube_d = 31.8;
-tube_d1 = 28;
+tube_d1 = 31.8;
 body_w = 10;
-body_h = 30;
+body_h = 45;
 
 wall = 2;
 
-led_d = 3 + 0.5;
+led_d = 3 + 1;
 
 zip_w = 3.5;
 zip_h = 2.5;
 
-top_w = 6+2*wall;
-top_led_h = body_h-9;
+top_w = 10+2*wall;
+top_led_h = body_h-14;
+
+led_angle_y = 30;
+led_angle_z = 30;
 
 cable_w = 6;
 cable_h = 3;
@@ -29,18 +32,6 @@ module body() {
 }
 
 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])
@@ -53,10 +44,18 @@ module chamber() {
                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]);
+               intersection() {
+                       translate([top_led_h + tube_d/2, -tube_d/2, body_w-wall])
+                               cube([infty, tube_d, 2*wall]);
+                       translate([top_led_h + tube_d/2, 0, 0])
+                               rotate([0, led_angle_y, -led_angle_z])
+                               translate([0, -infty/2, 0])
+                                       cube(infty);
+               }
                // wall with hole for LED
-               translate([top_led_h + tube_d/2, 1, wall])
+               translate([top_led_h + tube_d/2, 0, 0])
+                       rotate([0, led_angle_y, -led_angle_z])
+                       translate([0, 3, 0])
                        cube([wall, infty, infty]);
        }
 }
@@ -68,7 +67,7 @@ module holder() {
                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);
+                       cylinder(r1 = tube_d1/2, r2 = tube_d/2, h = body_w + 2*eps, $fn = 100);
                // zip tie hole
                scale([1, 1.05, 1])
                translate([0, 0, body_w/2 - zip_w/2])
@@ -78,12 +77,20 @@ module holder() {
                        }
                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]);
+               difference() {
+                       translate([tube_d/2 + wall + zip_h/2, -5, wall])
+                               cube([top_led_h + tube_d, tube_d, body_w]);
+                       translate([top_led_h + tube_d/2, 0, 0])
+                               rotate([0, led_angle_y, -led_angle_z])
+                               translate([0, -infty/2, 0])
+                                       cube(infty);
+               }
                // 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);
+               translate([tube_d/2+top_led_h+2*wall+body_w*sin(led_angle_y),
+                       1.5*wall, body_w/2-0.5])
+                       rotate([0, led_angle_y, -led_angle_z])
+                       rotate([0, -90, 0])
+                       cylinder(r = led_d/2, h = 10, $fn = 6);
                // cable hole
                hull() {
                        translate([tube_d/2 + wall + zip_h/2, -10,
@@ -95,5 +102,6 @@ module holder() {
        }
 }
 
+scale([-1, 1, 1]) // mirror it
 holder();