z-axis: shift mounts to under parts
authorClinton Ebadi <clinton@unknownlamer.org>
Wed, 22 May 2019 00:14:23 +0000 (20:14 -0400)
committerClinton Ebadi <clinton@unknownlamer.org>
Wed, 22 May 2019 00:14:23 +0000 (20:14 -0400)
I've been using these upside down the entire time... not sure this was
really worth it afterward (box_frame compatibility is still broken,
and all models still have different coordinate spaces...), but rolling
with it -- eventually want to have all models using the same
coordinate space to make the relationships between them
clearer (having to mentally transform coordinates is a pain).

Also cleaned up clearing of any walls that conflict with the motor and
some positioning.

box_frame/inc/settings.scad
box_frame/z-axis.scad

index b1ef8fa..edbd3c0 100644 (file)
@@ -28,7 +28,6 @@ zaxis_delta_x = (frame_type == frame_alu) ? 0 : 0;
 zaxis_delta_y = (frame_type == frame_alu) ? -5 : 0;
 
 // shift motor/leadscrew mount to clear bearings and x-rods
-// this is the model local coordinate space for the Z axis, so:
 // Y controls the extra distance between the motor and smooth rod, and
 // X controls the extra distance between the motor and the frame
 // TODO: auto calculate based on bearing (and leadscrew nut?) sizes
index a3042c1..f533396 100644 (file)
 
 // 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){
+     // fixme: board_to_xz_distance in position_y feels iffy
     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(){
@@ -38,17 +37,17 @@ module zmotorholder(thickness=(frame_type == frame_single ? 38 : 23), bottom_thi
                 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 = 14 + 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=[0, 1, 1, 1], h=bottom_thickness + layer_height, $fn=23, shadow=layer_height + 2);
+                        nema17(places=[0, 1, 1, 1], h=bottom_thickness + layer_height, $fn=23, shadow=false/*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);
+               translate([5 + zaxis_delta_x + zmotor_delta_x, 5 + zaxis_delta_y + zmotor_delta_y, -42.001]) {
+                    cube([43,43,42]);
                }
 
                // motor rotor clearance
                translate([position_x, position_y, 0]) {
-                    cylinder(r=11,h=20, center = true);
+                    #cylinder(r=11,h=20, center = true);
                }
 
                 // motor screw holes
@@ -60,7 +59,7 @@ module zmotorholder(thickness=(frame_type == frame_single ? 38 : 23), bottom_thi
                // 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);
+                        nema17(places=[1, 1, 1, 1], holes=true, h=bottom_thickness + 1, $fn=small_hole_segments);
                         //shadow=-6 + layer_height);
                 }
             }
@@ -78,18 +77,18 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
             difference(){
                 union() {
                     //piece along the flat side of a board
-                    cube_fillet([bottom_x, ylen, bottom_thickness], vertical=[8, 3, 0, 0]);
+                   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]);
+                        translate ([0, 0, -thickness + bottom_thickness]) cube_fillet([5, ylen, thickness], vertical=[0, 0, 0, 0], bottom = [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])
+                             translate ([-board_thickness - 5, 0, -thickness + bottom_thickness])
+                                  cube_fillet([5, ylen, thickness], vertical=[0, 0, 0, 0], bottom = [top_radius, 0, 0, 0]);
+                             translate ([-board_thickness, 5, bottom_thickness/2])
                                   cube ([board_thickness, ylen - 6, bottom_thickness/2]);
                         }
                    }
@@ -122,7 +121,7 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
                    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] + single_wall_width * 6, h = bearing_608[2] + layer_height*6);
+                        translate ([lead_bearing_x, lead_bearing_y, -(bearing_608[2] + layer_height * 6 - bottom_thickness)]) cylinder (d = bearing_608[0] + single_wall_width * 6, h = bearing_608[2] + layer_height*6);
                    }
                     //piece along cut side of the board
                    if (frame_type == frame_box) {
@@ -133,24 +132,24 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
 
                         translate ([0, 0 /* zaxis_delta_y */, 0]) {
                              // back
-                             translate([-board_thickness, 0, 0]) {
+                             translate([-board_thickness, 0, -thickness + bottom_thickness]) {
                                   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]);
+                             front_support_thickness = thickness / (am_top ? 1 : 1.5);
+                             translate ([0, 0, -front_support_thickness +  bottom_thickness]) cube_fillet([am_top ? board_to_xz_distance + zaxis_delta_x - smooth_rod_insert_radius : xlen , side_thickness, front_support_thickness], vertical = [0, 0, 0, 0], bottom = [0, 0, 0, thickness]);
                         }
 
                         if (zaxis_delta_x > 0 || zaxis_delta_y < 0) {
                              // extra support along edge of smooth rod hole, if it has been moved away from the frame
                              radius_diff = smooth_rod_insert_radius - bushing_z[0];
                              hull () {
-                                  translate([-board_thickness/3, zaxis_delta_x/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_thickness/3, zaxis_delta_x/3, -(thickness/2 - bottom_thickness)]) {
+                                       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], bottom = [0, 0, 4, thickness/2]);
                                   }
-                                  translate([board_to_xz_distance/2, zaxis_delta_y + 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]);
+                                  translate([board_to_xz_distance/2, zaxis_delta_y + radius_diff/6, - bottom_thickness]) {
+                                       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]], bottom = [0, 0, 2, thickness/4]);
                                   }
                              }
                         }
@@ -159,14 +158,16 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
                             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);
+                   rod_insert_h = bottom_thickness * (am_top ? 1.75 : 1.75);
+                    translate([board_to_xz_distance - z_delta + zaxis_delta_x, 9 + zaxis_delta_y, -rod_insert_h + bottom_thickness])
+                        cylinder(h=rod_insert_h, 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);
+               rod_insert_hole_h = am_top ? thickness+20 : bottom_thickness;
+                translate([board_to_xz_distance - z_delta + zaxis_delta_x, 9 + zaxis_delta_y, bottom_thickness - rod_insert_hole_h]) cylinder(h=rod_insert_hole_h + 1, 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);
@@ -176,10 +177,10 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
                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]) {
+                    translate ([lead_bearing_x, lead_bearing_y, bottom_thickness - bearing_608[2]]) {
                          union () {
-                              translate ([0, 0, 1]) cylinder (d = 10.8, h = bearing_608[2]*2);
-                              translate ([0, 0, -1]) cylinder (d = bearing_608[0], h = bearing_608[2]+1);
+                              translate ([0, 0, -bearing_608[2]*2 + 1]) cylinder (d = 10.8, h = bearing_608[2]*2);
+                              translate ([0, 0, 0]) cylinder (d = bearing_608[0], h = bearing_608[2]+1);
                          }
                     }
                }
@@ -199,26 +200,26 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
                     }
                 } 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])
+                    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 + bottom_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])
+                    translate([18, ylen - board_thickness/2, -thickness + bottom_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])
+                    translate([-board_thickness-18, ylen - board_thickness/2, -thickness + bottom_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])
+                    translate([-board_thickness-18, 5 + board_thickness/2, -thickness + bottom_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();
+                    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();
+                    translate([-board_thickness/2, -13, bottom_thickness + board_thickness/2 - thickness]) 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();
@@ -232,14 +233,15 @@ module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thick
 }
 
 if (frame_type == frame_alu) {
+     //zmotorholder(thickness=55, bottom_thickness=6);
      // 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=43 + zaxis_delta_x, 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=43 + zaxis_delta_x, bottom_thickness=6);
-
+     rotate ([0, 180, 0]) {
+         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=43 + zaxis_delta_x, 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=43 + zaxis_delta_x, bottom_thickness=6);
+     }
 }
 else {
      translate([10, -50, 0]) zmotorholder();