chiark / gitweb /
crossbar-computer-led-mount: wip TowerBulkCrossSection
[reprap-play.git] / crossbar-computer-led-mount.scad
index fb04685f0c40125747ff45e3597cb3eb280b04c7..9aac317b43ca140b98a43af9f271e6fec59ff299 100644 (file)
@@ -3,17 +3,33 @@
 led_dia = 5 + 0.6;
 led_depth = 5;
 
 led_dia = 5 + 0.6;
 led_depth = 5;
 
-test_width = 15;
-test_height = 12;
+led_tip_z = 70;
+led_angle = -60;
 
 
-thicks = [1,2,4,6];
+vert_space_inside = 8;
+backfront_space_inside = 12;
 
 
-module Tests(){
-  for (thicki=[0:len(thicks)-1]) {
+backfront_mate_size = 20;
+
+// tuning
+
+tower_over_angle = 45;
+tower_wall_thick = 1.6;
+tower_base_height = 5;
+
+//--- tests ---
+
+test_width = 24;
+test_height = 24;
+
+test_thicks = [9,14,21];
+
+module Tests(){ ////toplevel
+  for (thicki=[0:len(test_thicks)-1]) {
     translate([thicki*test_width-0.5, 0, 0]) {
       difference(){
        cube([test_width,
     translate([thicki*test_width-0.5, 0, 0]) {
       difference(){
        cube([test_width,
-             thicks[thicki] + led_depth,
+             test_thicks[thicki] + led_depth,
              test_height]);
        translate([test_width/2, -1, test_height/2])
          rotate([-90,0,0])
              test_height]);
        translate([test_width/2, -1, test_height/2])
          rotate([-90,0,0])
@@ -23,4 +39,44 @@ module Tests(){
   }
 }
 
   }
 }
 
-Tests();
+//Tests();
+
+//--- real thing ---
+
+tower_frontheight = 30; //fixme
+tower_overhang = led_dia * 4;
+
+tower_over_max_y = tower_overhang * sin(tower_over_angle);
+tower_over_max_z = tower_frontheight + tower_overhang * cos(tower_over_angle);
+tower_total_max_z = tower_over_max_z + vert_space_inside + led_depth;
+tower_rearwall_y = -(backfront_space_inside + tower_wall_thick);
+
+backfront_mate_extra = (backfront_mate_size - (-tower_rearwall_y))/2;
+
+module TowerWallCrossSection(){
+  // generates a 2D shape - a polygon
+  // x is what is going to be -y
+  // y is what is going to be z
+  polygon([[0,                  0],
+          [0,                  tower_frontheight],
+          [-tower_over_max_y,  tower_over_max_z],
+          [-tower_over_max_y,  tower_total_max_z],
+          [-tower_rearwall_y,  tower_total_max_z],
+          [-tower_rearwall_y,  0],
+          [-tower_rearwall_y+backfront_mate_extra, -tower_base_height],
+          [                 -backfront_mate_extra, -tower_base_height]]);
+}
+
+module TowerBulkCrossSection(){
+  intersection(){
+    TowerWallCrossSection();
+    union(){
+      translate([-tower_over_max_y/2,
+                tower_frontheight + tower_overhang*sin(tower_over_angle)/2])
+       circle(r = led_depth);
+    }
+  }
+}
+
+%TowerWallCrossSection();
+TowerBulkCrossSection();