Merge pull request #49 from AxTheB/master
[clinton/prusa3.git] / box_frame / inc / functions.scad
index ee22298..7b61a41 100644 (file)
@@ -131,6 +131,14 @@ module screw(h=20, r=2, r_head=3.5, head_drop=0, slant=i_am_box, poly=false, $fn
     }
 }
 
+module plate_screw(long=0) {
+    if (i_am_box == 0) {
+        translate([0, 0, -long]) screw(head_drop=14 + long, h=20 + long, r_head=3.6, r=1.7, $fn=24, slant=false);
+    } else {
+        translate([0, 0, -2 - long]) screw(head_drop=14 + long, h=20 + long, r_head=4.5, r=2, $fn=24, slant=true);
+    }
+}
+
 //radius of the idler assembly (to surface that touches belt, ignoring guide walls)
 function idler_assy_r_inner(idler_bearing) = (idler_bearing[0] / 2) + 4 * single_wall_width * idler_bearing[3];
 //radius of the idler assembly (to smooth side of belt)
@@ -143,12 +151,23 @@ module idler_assy(idler_bearing = [22, 7, 8, 1]) {
     //bearing shadow
     %cylinder(h = idler_bearing[1], r=idler_bearing[0]/2, center=true);
 
-    cylinder(h = idler_width + 1, r=idler_assy_r_outer(idler_bearing), center=true);
+    cylinder(h = idler_width + 1, r=idler_assy_r_outer(idler_bearing) + 0.5, center=true);
 }
 
+module belt(len, side = 0){
+    //belt. To be substracted from model
+    //len is in +Z, smooth side in +X, Y centered
+    translate([-0.5, 0, 0]) maketeeth(len);
+    translate([0, -4.5, -0.01]) cube([belt_thickness, 9, len + 0.02]);
+    if (side != 0) {
+    translate([0, -4.5 + side, -0.01]) cube_fillet([belt_thickness, 9, len + 0.02], vertical = [3, 0, 0, 0]);
+    }
+}
+
+
 module maketeeth(len){
-    //Belt teeth. To be substracted from model
+    //Belt teeth. 
     for (i = [0 : len / belt_tooth_distance]) {
-        translate([0, 0, i * belt_tooth_distance]) cube([2, 10, belt_tooth_distance * belt_tooth_ratio], center = true);
+        translate([0, 0, i * belt_tooth_distance]) cube([2, 9, belt_tooth_distance * belt_tooth_ratio], center = true);
     }
 }