Procházet zdrojové kódy

Commit missing code

alancnet před 1 rokem
rodič
revize
b4b7a4840c
2 změnil soubory, kde provedl 177 přidání a 100 odebrání
  1. 167 98
      DiceTower.scad
  2. 10 2
      config.scad

+ 167 - 98
DiceTower.scad

@@ -117,15 +117,17 @@ module stairs(radius, height, twists = 1, step_height = 1, step_depth = 1, overh
 module banister() {
   // Banister
   y = 10;
+  left = 1;
+  right = 2;
   {
     intersection() {
       translate([-tower_radius, 0, 0]) rotate([0,0,exit]) scale([-1, 1, 1]) {
         difference() {
-          cylinder(r=tower_radius + 2, h=tower_radius+y, center=false);
-          translate([0,0,-1]) cylinder(r=tower_radius, h=tower_radius + 2+y, center=false);
+          cylinder(r=tower_radius + left, h=tower_radius+y, center=false);
+          translate([0,0,-1]) cylinder(r=tower_radius - 4, h=tower_radius + 2+y, center=false);
         }
       }
-      translate([0,0,-2]) cylinder(r=tower_radius - 2, h=tower_radius + 4 + y, center=false);
+      translate([0,0,-2]) cylinder(r=tower_radius - right, h=tower_radius + 4 + y, center=false);
     }
     
   }
@@ -191,7 +193,10 @@ module dungeon_bars() {
     if (n >= 0) {
       rotate([0,0,n * -14.5]) translate([0, tower_radius - (2.5 * 1.5), 0]) scale([1,1.25,1]) {
         bonus=sin((n/max) * 180) * 18.5 + 4;
-        cylinder(r=2.5, h=dungeon_height + bonus, center=false);
+        difference() {
+          cylinder(r=2.5, h=dungeon_height + bonus, center=false);
+          cylinder(r=0.1, h=dungeon_height + bonus, center=false);
+        }
       }
       loop(n - 1);
     }
@@ -248,126 +253,190 @@ module window_rim(h, z) {
 
 module detents(clearance = 0) {
   rotate([0,0,45]) {
-    rotate([0,0,0]) translate([tower_radius - brick_depth / 2,0,0]) sphere(1.5 + clearance);
-    rotate([0,0,180]) translate([tower_radius - brick_depth / 2,0,0]) sphere(1.5 + clearance);
+    rotate([0,0,0]) translate([tower_radius - brick_depth / 2,0,0]) sphere(1.5 + clearance, $fn=16);
+    rotate([0,0,180]) translate([tower_radius - brick_depth / 2,0,0]) sphere(1.5 + clearance, $fn=16);
     detent_r = pin_diameter / 2 + pin_clearance * 2;
-    translate([0,0,pin_height - detent_r]) sphere(detent_r + clearance);
+    //translate([0,0,pin_height - detent_r]) sphere(detent_r + clearance);
   }
 }
-//if (false)
-union() {
-  color("grey") floor();
-  color("grey") double_stairs();
-  color("grey") difference() {
-    tower(tower_radius, tower_height);
-    front_door_neg();
-    dungeon_window_neg();
-    window_neg(100, 0);
-    window_neg(100, 180);
-    window_neg(75, 60);
-    window_neg(75, 240);
-    window_neg(50, 120);
-    window_neg(50, 300);
-  }
-  color("grey") intersection() {
-    //tower(tower_radius + 5, 60);
-    difference() {
-      cylinder(r=tower_radius + 5, h=60, center=false);
-      cylinder(r=tower_radius + 5 - brick_depth, h=60, center=false);
-    }
-    union() {
-      front_door_rim();
-      dungeon_window_rim();
+
+scale([-1,1,1]) {
+
+
+  if (false)
+  union() {
+    color("grey") floor();
+    color("grey") difference() {
+      tower(tower_radius, tower_height);
+      front_door_neg();
+      dungeon_window_neg();
+      window_neg(100, 0);
+      window_neg(100, 180);
+      window_neg(75, 60);
+      window_neg(75, 240);
+      window_neg(50, 120);
+      window_neg(50, 300);
     }
-  }
-  color("grey") intersection() {
-    
-    //tower(tower_radius + 2, tower_height);
-    difference() {
-      cylinder(r=tower_radius + 2, h=tower_height, center=false);
-      cylinder(r=tower_radius + 2 - brick_depth, h=tower_height, center=false);
+    color("grey") intersection() {
+      //tower(tower_radius + 5, 60);
+      difference() {
+        cylinder(r=tower_radius + 5, h=60, center=false);
+        cylinder(r=tower_radius + 5 - brick_depth, h=60, center=false);
+      }
+      union() {
+        front_door_rim();
+        dungeon_window_rim();
+      }
     }
-    union() {
-      window_rim(100, 0);
-      window_rim(100, 180);
-      window_rim(75, 60);
-      window_rim(75, 240);
-      window_rim(50, 120);
-      window_rim(50, 300);
+    color("grey") intersection() {
+      
+      //tower(tower_radius + 2, tower_height);
+      difference() {
+        cylinder(r=tower_radius + 2, h=tower_height, center=false);
+        cylinder(r=tower_radius + 2 - brick_depth, h=tower_height, center=false);
+      }
+      union() {
+        window_rim(100, 0);
+        window_rim(100, 180);
+        window_rim(75, 60);
+        window_rim(75, 240);
+        window_rim(50, 120);
+        window_rim(50, 300);
+      }
     }
-  }
-  color("grey") dungeon_bars();
-  color("grey") bottom_stairs_and_banister();
+    color("grey") dungeon_bars();
+    color("grey") bottom_stairs_and_banister();
 
-  color("grey") cylinder(r=pin_diameter / 2, h=tower_height + pin_height, center=false);
+    difference() {
+      union() {
+        color("grey") double_stairs();
+        color("grey") cylinder(r=pin_diameter / 2, h=tower_height, center=false);
+      }
+      translate([0,0,tower_height - screw_length]) cylinder(r=screw_diameter / 2, h=screw_length + 1, center=false, $fn=16);
+    }
 
-  color("red") translate([0,0,tower_height]) detents();
-}
+    color("red") translate([0,0,tower_height - 0.25]) detents();
+  }
 
-//$fn=25;
-//if (false) 
-color("grey") translate([0,0,tower_height]) {
-  radius = tower_radius + 5;
-  difference() {
-    union() {
-      translate([0, 0, 20]) sphere(7);
-      difference() {
-        union() {
-          tower(radius, 25);
-          difference() {
-            cylinder(r=radius - brick_depth / 2, h=2, center=false);
-            linear_extrude(height=5, center=true) {
-              pie_slice(tower_radius - brick_depth, -100, 45);
+  //$fn=25;
+  // Top
+  //if (false) 
+  color("grey") translate([0,0,tower_height]) {
+    radius = tower_radius + 5;
+    difference() {
+      union() {
+        //translate([0, 0, 20]) sphere(7);
+        difference() {
+          union() {
+            tower(radius, 25);
+            difference() {
+              cylinder(r=radius - brick_depth / 2, h=2, center=false);
+              linear_extrude(height=5, center=true) {
+                pie_slice(tower_radius - brick_depth, -100, 45);
+              }
+              translate([0,0,2]) { // Grooves
+                rotate_extrude(convexity=10) {
+                  translate([(radius - brick_depth / 2) * .25, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+                  translate([(radius - brick_depth / 2) * .5, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+                  translate([(radius - brick_depth / 2) * .75, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+                }
+                for (i=[1:5]) {
+                  rotate([0,90+180,45+180 + 35 * i]) rotate([0,0,45]) linear_extrude(height=tower_radius, center=false, convexity=10, twist=0) {
+                      square(groove, groove, center=true);
+                  }
+                }
+              }
             }
-            translate([0,0,2]) { // Grooves
-              rotate_extrude(convexity=10) {
-                translate([(radius - brick_depth / 2) * .25, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
-                translate([(radius - brick_depth / 2) * .5, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
-                translate([(radius - brick_depth / 2) * .75, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+
+            // Wall
+            rotate([0,0,-100]) translate([0, -2]) {
+              translate([25,0,0]) cube([radius - brick_depth / 2 - 25, 2, 20]);
+              intersection() {
+                cube([radius - brick_depth / 2, 2, 20]);
+                rotate([90, 0]) translate([25,0,0]) cylinder(r=20, h=10, center=true, $fn=100);
               }
-              for (i=[1:5]) {
-                rotate([0,90+180,45+180 + 35 * i]) rotate([0,0,45]) linear_extrude(height=tower_radius, center=false, convexity=10, twist=0) {
-                    square(groove, groove, center=true);
+            }
+            
+            //cylinder(r=pin_diameter / 2 + pin_clearance * 2 + 2, h=20, center=false);
+            translate([0,0,25 - 3.5]) {
+              difference() {
+                rotate_extrude(convexity=10) {
+                  translate([radius - brick_depth / 2, 0, 0]) rotate([0,0,45]) square([7,7]);
                 }
               }
             }
           }
-          rotate([0,0,-100]) translate([0, -2]) cube([radius - brick_depth / 2, 2, 20]);
-          cylinder(r=pin_diameter / 2 + pin_clearance * 2 + 2, h=20, center=false);
-          translate([0,0,25 - 3.5]) {
-            difference() {
-              rotate_extrude(convexity=10) {
-                translate([radius - brick_depth / 2, 0, 0]) rotate([0,0,45]) square([7,7]);
+          rampart_width = 15;
+          ramparts = 8;
+
+          translate([0,0,20]) {
+            for (z = [0:ramparts - 1]) {
+              rotate([0,0,360 / ramparts * z])
+              linear_extrude(height=20, center=false, convexity=10, twist=0) {
+                pie_slice(radius + 10, -rampart_width / 2, rampart_width / 2);
               }
             }
           }
         }
-        rampart_width = 15;
-        ramparts = 8;
-
-        translate([0,0,20]) {
-          for (z = [0:ramparts - 1]) {
-            rotate([0,0,360 / ramparts * z])
-            linear_extrude(height=20, center=false, convexity=10, twist=0) {
-              pie_slice(radius + 10, -rampart_width / 2, rampart_width / 2);
-            }
+        translate([0,0,2]) { // Lip
+          rotate([0,90+180,45+180]) rotate([0,0,45]) linear_extrude(height=tower_radius, center=false, convexity=10, twist=0) {
+              square(groove, groove, center=true);
+          }
+        }
+        translate([0,0,2]) { // Rim
+          rotate_extrude(convexity=10) {
+            translate([radius - .25, 0, 0]) circle(2, center=true);
           }
         }
+        cylinder(r=5, h=2 + screw_head_height, center=false);
       }
-      translate([0,0,2]) { // Lip
-        rotate([0,90+180,45+180]) rotate([0,0,45]) linear_extrude(height=tower_radius, center=false, convexity=10, twist=0) {
-            square(groove, groove, center=true);
+      color("red") detents(pin_clearance);
+      //cylinder(r=pin_diameter / 2 + pin_clearance * 2, h=pin_height + pin_clearance, center=true);
+      // Stress relief // rotate([0,0,-30]) translate([0,-.5, -1]) cube([10,2,10]);
+
+      translate([0,0,0]) { // Groove
+        rotate_extrude(convexity=10, $fn=50) {
+          translate([tower_radius - brick_depth / 2, 0, 0]) circle(1, center=true, $fn=15);
         }
       }
-      translate([0,0,2]) { // Rim
-        rotate_extrude(convexity=10) {
-          translate([radius - .25, 0, 0]) circle(2, center=true);
+
+
+      cylinder(r=screw_diameter/2, h=10, center=true, $fn=16);
+      translate([0,0,2]) cylinder(r=screw_head_diameter/2, h=100, center=false, $fn=16);
+
+    }
+
+  }
+
+
+
+
+
+  // Bottom
+  if (false)
+  color("grey") rotate([0,0,exit]) translate([0, -tower_radius,0]) {
+    radius = tower_radius + 5;
+    difference() {
+      union() {
+        tower(radius, bottom_height);
+        difference() {
+          cylinder(r=radius - brick_depth / 2, h=2, center=false);
+          translate([0,0,2]) { // Grooves
+            rotate_extrude(convexity=10) {
+              translate([(radius - brick_depth / 2) * .25, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+              translate([(radius - brick_depth / 2) * .5, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+              translate([(radius - brick_depth / 2) * .75, 0, 0]) rotate([0,0,45]) square([groove,groove], center=true);
+            }
+            for (i=[4:10]) {
+              rotate([0,90+180,45+180 + 35 * i]) rotate([0,0,45]) linear_extrude(height=tower_radius, center=false, convexity=10, twist=0) {
+                  square(groove, groove, center=true);
+              }
+            }
+          }
         }
       }
+      translate([0, tower_radius,0]) cylinder(r=tower_radius - brick_depth / 2, h=26, center=false);
     }
-    color("red") detents(pin_clearance);
-    cylinder(r=pin_diameter / 2 + pin_clearance * 2, h=pin_height + pin_clearance, center=true);
-    rotate([0,0,-30]) translate([0,-.5, -1]) cube([10,2,10]);
   }
 
-}
+}

+ 10 - 2
config.scad

@@ -14,7 +14,6 @@ step_height=5;
 step_depth=6.7; // 5;
 twists = 2;
 underslope=68; //62.5;
-pin_diameter=6;
 pin_height=10;
 outer_pin_distance=37.2;
 outer_pin_diameter=4;
@@ -22,4 +21,13 @@ outer_pin_angle=180;
 dungeon_angle=exit - 180;//55;
 dungeon_extra=step_height * 5;
 
-pin_clearance = 0.125;
+pin_clearance = 0.125;
+
+screw_length = 30;
+screw_diameter = 3.45;
+screw_head_diameter = 7.75;
+screw_head_height = 3.2;
+
+pin_diameter=screw_diameter+2;
+
+bottom_height=15;