z-axis: remove built-in support for leadscrew bearing holder
[clinton/prusa3.git] / box_frame / z-axis.scad
dissimilarity index 76%
index 0983a4b..c1de637 100644 (file)
-// PRUSA iteration3
-// Z axis
-// GNU GPL v3
-// Josef Průša <josefprusa@me.com>
-// Václav 'ax' Hůla <axtheb@gmail.com>
-// http://www.reprap.org/wiki/Prusa_Mendel
-// http://github.com/prusajr/PrusaMendel
-
-include <configuration.scad>
-
-module zmotorholder(thickness=23, bottom_thickness=5){
-    difference(){
-        union(){
-            // Motor holding part
-            difference(){
-                union(){
-                    zrodholder(thickness=thickness, xlen=45, ylen=45, zdelta=((i_want_to_use_single_plate_dxf_and_make_my_z_weaker == 0) ? 0 : 5));
-                    translate([board_to_xz_distance, board_to_xz_distance, 0]) {
-                        nema17(places=[0, 1, 1, 1], h=bottom_thickness + layer_height);
-                    }
-                }
-
-                // motor screw holes
-                translate([board_to_xz_distance, board_to_xz_distance, thickness]) {
-                    mirror([0, 0, 1]) translate([0, 0, thickness-8])
-                        nema17(places=[0, 1, 1, 1], holes=true, h=bottom_thickness + 1, shadow=5);
-                }
-            }
-        }
-    }
-}
-
-
-module zrodholder(thickness=15, bottom_thickness=5, ylen=42, xlen=34, zdelta=0){
-    holder_inner_r = 9;
-    difference(){
-        union(){
-            difference(){
-                union(){
-                    //piece along the flat side of a board
-                    cube_fillet([14, ylen, bottom_thickness], vertical=[8, 3, 0, 0]);
-                    cube_fillet([5, ylen, thickness], vertical=[3, 3, 0, 0], top = [thickness/2, 0, 0, 5]);
-                    //hole for Z axis is thru this
-                    cube_fillet([xlen, 14, bottom_thickness], vertical=[3, 0, 0, 3]);
-                    translate([14,14,0]) {
-                        //large fillet that makes it stiffer by lot. Thanks to Marcus Wolschon
-                        difference(){
-                            cube([holder_inner_r,holder_inner_r,bottom_thickness]);
-                            translate([holder_inner_r, holder_inner_r, -0.5])
-                                cylinder(r=holder_inner_r, h=bottom_thickness + 1);
-                        }
-                    }
-                    //piece along cut side of the board
-                    if (i_am_box == 1) {
-                        translate([-board_thickness, 0, 0]) 
-                            cube_fillet([board_thickness + board_to_xz_distance + bushing_z[0], 5, thickness], radius=2, top = [0, 0, 0, thickness]);
-                    } else {
-                        translate([-board_thickness/2, 0, 0]) 
-                            cube_fillet([board_thickness/2 + board_to_xz_distance + bushing_z[0], 5, thickness], radius=2, top = [0, 0, 0, thickness]);
-                    }
-                    //smooth rod insert
-                    translate([board_to_xz_distance - z_delta, 9, 0]) intersection() {
-                        cylinder(h=bottom_thickness + layer_height, r=(bushing_z[0] + 5 * single_wall_width));
-                        if (bushing_z[0] < 5) {
-                            translate([0, -5 , bottom_thickness / 2]) cube([20, 20, bottom_thickness + 10], center=true);
-                        } else {
-                            translate([0, -bushing_z[0], bottom_thickness / 2]) cube([bushing_z[0] * 4, bushing_z[0] * 4, bottom_thickness + 10], center=true);
-                        }
-                    }
-                }
-                //smooth rod hole
-                translate([board_to_xz_distance - z_delta, 9, -1]) cylinder_poly(h=board_thickness+20, r=bushing_z[0]);
-                // cutout
-                translate([board_to_xz_distance-1, 5+(bushing_z[0]), 0.4]) cube([2, 10, 100]);
-                //inside rouned corner
-                translate([0, 5, -1]) cylinder(r=1.2, h=100, $fn=8);
-                //side screw
-                //translate([-board_thickness/2, 0, thickness/2-1.5]) rotate([-90, 0, 0]) screw(h=30, r_head=4);
-                //front screws
-                if (i_am_box != 1) {
-                    //single plate has both screws on front
-                    translate([16, 35.5, bottom_thickness + 4.5 + zdelta]) rotate([0, -90, 0]) {
-                        screw(head_drop=14, h=122, r_head=4.5);
-                    }
-                    translate([16, 15.5, bottom_thickness + 4.5 + zdelta]) rotate([0, -90, 0]) {
-                        screw(head_drop=14, h=122, r_head=4.5);
-                    }
-                } else {
-                    translate([16, 30, bottom_thickness+4]) rotate([0, -90, 0]) {
-                        screw(head_drop=12, h=122, r_head=4);
-                    }
-                    //side screw
-                    translate([-board_thickness/2, 0, thickness/2]) rotate([-90, 0, 0]) screw(h=30, r_head=4.5, head_drop=1);
-                }
-            }
-        }
-    }
-}
-translate([0, -2, 0]) mirror([0, 1, 0]) zmotorholder();
-translate([0, 2, 0]) zmotorholder();
-translate([21, -62, 0]) zrodholder();
-translate([20, 62, 0]) mirror([0, 1, 0]) zrodholder();
+// PRUSA iteration3
+// Z axis
+// GNU GPL v3
+// Josef Průša <josefprusa@me.com>
+// Václav 'ax' Hůla <axtheb@gmail.com>
+// http://www.reprap.org/wiki/Prusa_Mendel
+// http://github.com/josefprusa/Prusa3
+
+// ThingDoc entries
+/**
+ * @id zMotorHolder
+ * @name Z Axis Motor Holder
+ * @category Printed
+ */
+
+/**
+ * @id zRodHolder
+ * @name Z Axis Rod Holder
+ * @category Printed
+ */
+
+// todo
+
+//  - fix motor holder wall removal so it is sensible and actually
+//    removes the right thing
+// - fix changing board_thickness, add way to specify # of bolts in
+//   side of frame (assume even spacing for now)
+
+include <configuration.scad>
+
+module zmotorholder(thickness=(frame_type == frame_single ? 38 : 23), bottom_thickness=5){
+    position_y = board_to_xz_distance + zaxis_delta_y + zmotor_delta_y;
+    position_x = board_to_xz_distance + zaxis_delta_x + zmotor_delta_x;
+    difference(){
+        union(){
+            // Motor holding part
+            difference(){
+                union(){
+                    zrodholder(thickness=thickness, xlen=45 + zmotor_delta_x + zaxis_delta_x, ylen=48 + 5 + zmotor_delta_y + zaxis_delta_y, zdelta=((i_want_to_use_single_plate_dxf_and_make_my_z_weaker == 0) ? 0 : 5), bottom_x = 50 + zaxis_delta_x + zmotor_delta_x, bottom_y = 15 + zmotor_delta_y + zaxis_delta_y, am_top=0, bottom_thickness=bottom_thickness);
+                    translate([position_x, position_y, 0]) {
+                        nema17(places=[1, 1, 1, 1], h=bottom_thickness + layer_height, $fn=23, shadow=layer_height + 2);
+                    }
+                }
+               // remove any interfering walls
+               translate([position_x, position_y, layer_height + 2 + 21 +3]) {
+                    cube([43 + zmotor_delta_x + zaxis_delta_x,43,42], center = true);
+               }
+
+               // motor rotor clearance
+               translate([position_x, position_y, 0]) {
+                    cylinder(r=11,h=20, center = true);
+               }
+
+                // motor screw holes
+
+               // FIXME: y = board_to_xz distance looks supicious --
+               // the smooth rod is offset by a fixed amount so why
+               // would the motor mount be moved in both directions
+               // instead of just away from the frame? X-axis does
+               // not use this to offset the leadscrew hole either.
+               translate([position_x, position_y, thickness]) {
+                    mirror([0, 0, 1]) translate([0, 0, thickness-8])
+                        #nema17(places=[1, 1, 1, 1], holes=true, h=bottom_thickness + 1, $fn=small_hole_segments);
+                        //shadow=-6 + layer_height);
+                }
+            }
+        }
+    }
+}
+
+
+module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thickness=5, ylen=44, xlen=34, zdelta=0, bottom_y=14, bottom_x=14, am_top=1){
+    holder_inner_r = 9;
+    holder_inner_r2 = 2;
+    smooth_rod_insert_radius = bushing_z[0] + 5 * single_wall_width;
+    difference(){
+        union(){
+            difference(){
+                union() {
+                    //piece along the flat side of a board
+                    cube_fillet([bottom_x, ylen, bottom_thickness], vertical=[8, 3, 0, 0]);
+                   if (frame_type == frame_alu) {
+                        top_radius = am_top ? thickness : thickness / 3;
+                        cube_fillet([5, ylen, thickness], vertical=[0, 0, 0, 0], top = [top_radius, 0, 0, 0]);
+
+                        // FIXME: make rear/top bit optional, but don't remove entirely
+                        //        (printer seems to make less noise with the rear bit)
+                        %if (am_top) {
+                             // rear bracket
+                             translate ([-board_thickness - 5, 0, 0])
+                                  cube_fillet([5, ylen, thickness], vertical=[0, 0, 0, 0], top = [top_radius, 0, 0, 0]);
+                             translate ([-board_thickness, 5, 0])
+                                  cube ([board_thickness, ylen - 6, bottom_thickness/2]);
+                        }
+                   }
+                   else {
+                        cube_fillet([5, ylen, thickness], vertical=[3, 3, 0, 0], top = [thickness / 1.7, 0, 0, 5]);
+                   }
+
+                   //hole for Z axis is thru this
+                    cube_fillet([xlen + zaxis_delta_x, bottom_y, bottom_thickness], vertical=[3, 0, 0, 3]);
+                   if (bottom_x < board_to_xz_distance - z_delta + zaxis_delta_x) {
+                        translate([bottom_x, bottom_y, 0]) {
+                             //large fillet that makes it stiffer by lot. Thanks to Marcus Wolschon
+                             difference(){
+                                  cube([holder_inner_r, holder_inner_r, bottom_thickness]);
+                                  translate([holder_inner_r, holder_inner_r, -0.5])
+                                       cylinder(r=holder_inner_r, h=bottom_thickness + 1);
+                             }
+                        }
+                   }
+                   if (frame_type != frame_alu) {
+                        translate([5, 5, 0]) {
+                             difference(){
+                                  cube([holder_inner_r2, holder_inner_r2, thickness - 5.5]);
+                                  translate([holder_inner_r2, holder_inner_r2, -0.5])
+                                       cylinder(r=holder_inner_r2, h=thickness + 1, $fn=20);
+                             }
+                        }
+                    }
+                   // leadscrew bearing hole is cut from this
+                   if (am_top) {
+                        lead_bearing_y = board_to_xz_distance + zaxis_delta_y + zmotor_delta_y;
+                        lead_bearing_x = board_to_xz_distance + zaxis_delta_x + zmotor_delta_x;
+                        translate ([lead_bearing_x, lead_bearing_y, 0]) cylinder (d = bearing_608[0] + 1 + 2, h = bearing_608[2] + layer_height*4);
+                   }
+                    //piece along cut side of the board
+                   if (frame_type == frame_box) {
+                        translate([-board_thickness, 0, 0])
+                             cube_fillet([board_thickness + board_to_xz_distance + bushing_z[0], 5, thickness], radius=2, top = [0, 0, 0, thickness], $fn=99);
+                   } else if (frame_type == frame_alu) {
+                        side_thickness = 5.0;// - zaxis_delta_y;
+
+                        translate ([0, 0 /* zaxis_delta_y */, 0]) {
+                             // back
+                             translate([-board_thickness, 0, 0]) {
+                                  cube_fillet([board_thickness, side_thickness, thickness], vertical = [0, 0, 0, 0], top = [0, 0, 0, 0]);
+                             }
+
+                             // front
+                             //cube_fillet([am_top ? board_to_xz_distance + zaxis_delta_x - smooth_rod_insert_radius : xlen + zaxis_delta_x , side_thickness, thickness], vertical = [2, 0, 0, 0], top = [0, 0, 0, thickness]);
+                             cube_fillet([am_top ? board_to_xz_distance + zaxis_delta_x - smooth_rod_insert_radius : xlen , side_thickness, thickness / (am_top ? 1 : 1.5)], vertical = [2, 0, 0, 0], top = [0, 0, 0, thickness]);
+
+                             // extra support for motor
+                             if (!am_top) {
+                                  translate ([0, ylen - side_thickness, 0]) cube_fillet([xlen/* board_to_xz_distance + zaxis_delta_x - smooth_rod_insert_radius */ , side_thickness, thickness/1.5], vertical = [2, 0, 0, 0], top = [0, 0, 0, thickness]);
+                             }
+                        }
+
+                        // extra support along edge of smooth rod hole
+                        radius_diff = smooth_rod_insert_radius - bushing_z[0];
+                        hull () {
+                             translate([-board_thickness/3, -zaxis_delta_y/3, 0]) {
+                                  cube_fillet([board_thickness/3 + board_to_xz_distance + zaxis_delta_x - bushing_z[0] , -zaxis_delta_y/3 , thickness/2], vertical = [2, 0, 4, 0], top = [0, 0, 4, thickness/2]);
+                             }
+                             translate([board_to_xz_distance/2, -zaxis_delta_x + radius_diff/6, 0]) {
+                                  cube_fillet([board_to_xz_distance/2 + zaxis_delta_x  + smooth_rod_insert_radius*0.75, radius_diff/3 , bottom_thickness*2], vertical = [2, 0, 4, bushing_z[0] * smooth_rod_insert_radius/bushing_z[0]], top = [0, 0, 2, thickness/4]);
+                             }
+                        }
+                    } else {
+                        translate([-board_thickness/2, 0, 0])
+                            cube_fillet([board_thickness/2 + board_to_xz_distance + bushing_z[0], 5, thickness], radius=2, top = [0, 0, 0, thickness], $fn=99);
+                    }
+                    //smooth rod insert
+                    translate([board_to_xz_distance - z_delta + zaxis_delta_x, 9 + zaxis_delta_y, 0])
+                        cylinder(h=bottom_thickness * (am_top ? 1.75 : 1.75), r=smooth_rod_insert_radius);
+                }
+
+               // === difference ===
+
+                //smooth rod hole
+                #translate([board_to_xz_distance - z_delta + zaxis_delta_x, 9 + zaxis_delta_y, -1]) cylinder(h=am_top ? thickness+20 : bottom_thickness, r=bushing_z[0] + single_wall_width / 4);
+                //inside rouned corner
+               if (frame_type != frame_alu) {
+                    translate([0, 5, -1]) cylinder(r=0.8, h=100, $fn=8);
+               }
+
+               // leadscrew hole
+               if (am_top) {
+                    lead_bearing_y = board_to_xz_distance + zaxis_delta_y + zmotor_delta_y;
+                    lead_bearing_x = board_to_xz_distance + zaxis_delta_x + zmotor_delta_x;
+                    translate ([lead_bearing_x, lead_bearing_y, 0]) {
+                         difference () {
+                              union () {
+                                   translate ([0, 0, 1]) cylinder (d = 10.8, h = bearing_608[2]*2);
+                                   translate ([0, 0, -1]) cylinder (d = 23, h = bearing_608[2]+1);
+                              }                               
+                         }
+                    }
+               }
+
+                //front screws
+                if (frame_type == frame_single) {
+                    //single plate has both screws on front
+                    translate([16, 35, bottom_thickness + 4.5 + zdelta]) rotate([0, -90, 0]) {
+                         plate_screw();
+                    }
+                    translate([16, 15, bottom_thickness + 4.5 + zdelta]) rotate([0, -90, 0]) {
+                         plate_screw();
+                    }
+                    //motor mount has third screw
+                    translate([16, 25, bottom_thickness + 4.5 + zdelta + 20]) rotate([0, -90, 0]) {
+                         plate_screw();
+                    }
+                } else if (frame_type == frame_alu) {
+                    // three screws on front
+                    translate([18, ylen - board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, -90, 0]) plate_screw();
+                    translate([18, 5 + board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, -90, 0]) plate_screw();
+                    translate([18, 5 + board_thickness/2, thickness - board_thickness/2]) rotate([0, -90, 0])
+                         plate_screw();
+
+                    // motor mount screw for opposite extrusion
+                    translate([18, ylen - board_thickness/2, thickness - board_thickness/2]) rotate([0, -90, 0])
+                         plate_screw();
+
+                    // back plate
+                    translate([-board_thickness-18, ylen - board_thickness/2, thickness - board_thickness/2]) rotate([0, 90, 0])
+                         plate_screw();
+                    translate([-board_thickness-18, 5 + board_thickness/2, thickness - board_thickness/2]) rotate([0, 90, 0])
+                         plate_screw();
+                    translate([-board_thickness-18, ylen - board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, 90, 0]) plate_screw();
+                    #translate([-board_thickness-18, 5 + board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, 90, 0]) plate_screw();
+
+                    //side screws
+                    #translate([-board_thickness/2, -13, thickness-board_thickness/2]) rotate([-90, 0, 0]) plate_screw();
+                    translate([-board_thickness/2, -13, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([-90, 0, 0]) plate_screw();
+               } else if (frame_type == frame_box) {
+                    translate([16, 30, bottom_thickness+4]) rotate([0, -90, 0]) {
+                         plate_screw();
+                    }
+                    //side screw
+                    translate([-board_thickness/2, -11, thickness/2]) rotate([-90, 0, 0]) plate_screw();
+                }
+            }
+        }
+    }
+}
+
+if (frame_type == frame_alu) {
+     // 2020 aluminum frame parts are larger
+     translate([0, -60, 0]) zmotorholder(thickness=55, bottom_thickness=6);
+     translate([0, 60, 0]) mirror([0, 1, 0]) zmotorholder(thickness=55, bottom_thickness=6);
+
+     translate([110 + board_thickness, board_thickness+10, 0])  rotate([0,0,90])  zrodholder(thickness=board_thickness * 2 + 5, ylen = board_thickness * 2 + 10, bottom_x=48, bottom_thickness=6);
+     translate([110 + board_thickness, -(board_thickness+10), 0]) rotate([0, 0, -90]) mirror([0, 1, 0]) zrodholder(thickness=board_thickness * 2 + 5, ylen = board_thickness * 2 + 10, bottom_x=48, bottom_thickness=6);
+
+}
+else {
+     translate([10, -50, 0]) zmotorholder();
+     translate([0, 50, 0]) mirror([0, 1, 0]) zmotorholder();
+     translate([67, 14, 0]) rotate([0,0,90]) zrodholder();
+     translate([77, -14, 0]) rotate([0, 0, -90]) mirror([0, 1, 0]) zrodholder();
+}