Loading openscad/libs/main_body_structure.scad +12 −4 Original line number Diff line number Diff line Loading @@ -406,6 +406,8 @@ module xy_legs_and_actuators(params){ cut_depth = (c270_oversize - leg_sep)/2; cut_xy = min(cut_depth, leg_dims(params).x - tiny()) * sin(45); c270_z_space = 22; c270_mid_z = (upper_xy_flex_z(params) - 1) - (c270_z_space + 4)/2; cut_round = 2; // c270 cover rounding radius manual = !(key_lookup("include_motor_lugs", params)); Loading @@ -422,8 +424,9 @@ module xy_legs_and_actuators(params){ leg_frame(params, 135){ leg(params); } translate_z(45){ rounded_cube([c270_oversize, 99, c270_z_space+4], 7, center=true); translate_z(c270_mid_z){ rounding = max(cut_round,5); rounded_cube([c270_oversize, 99, c270_z_space+4], rounding, center=true); } } } Loading @@ -431,8 +434,13 @@ module xy_legs_and_actuators(params){ } if (manual){ // make space for the c270 camera translate_z(45){ rounded_cube([c270_oversize, 99, c270_z_space], 6, center=true); translate_z(c270_mid_z){ rounded_cube([c270_oversize, 99, c270_z_space], cut_round, center=true); reflect_x(){ translate([-(leg_sep/2 + (cut_depth - cut_round)), 0, c270_z_space/2 - cut_round]){ tangent_to_cylinder_plus(r=cut_round, angle=30, box=10); } } } } } Loading openscad/libs/utilities.scad +112 −0 Original line number Diff line number Diff line Loading @@ -1185,6 +1185,7 @@ module cylinder_to_square_column(d=undef, r=undef, h=undef, transition=undef){ } } /* Create a cube that is rounded on top and flat on the bottom :param dimensions: `[x, y, z]` dimensions of cube Loading Loading @@ -1225,6 +1226,7 @@ module round_top_cube(dimensions, rounding_radius, center=false){ } } /* Create a cube with rounded edges and corners :param dimensions: `[x, y, z]` dimensions of cube Loading Loading @@ -1257,6 +1259,7 @@ module rounded_cube(dimensions, rounding_radius, center=false){ } } /* Create a 2D projection-cut through z=0 or very slightly above. :param shift: If `true` the object is shifted down by `tiny()` before cutting at z=0 Loading @@ -1270,6 +1273,115 @@ module flatten(shift=true){ } /* Create a tangent to a cylinder rising in the positive x direction Intended for cutting round-chamfered sections from a block using difference(). The cylinder lies in the y-direction, centred on the origin. This version has the rising chamfer in the positive x-direction, see tangent_to_cylinder_minus() for a rising chamfer in the negative x-direction. ### Example ```example difference(){ translate_x(-20){ cube([20,20,50],center=false); } translate_x(-6){ hull(){ translate_z(15){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } #tangent_to_cylinder_plus(r=3, angle=30, box=10); } translate_z(5){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } } translate_z(5-3){ translate_y(-99/2){ cube([9,99,10], center=false); } } } } } ``` :param r: radius of the cylinder to tangent :param h: height of the cylinder to tangent (in y-direction) :param angle: angle, rising to positive x :param box: side length of the box that is tangent to the cylinder */ module tangent_to_cylinder_plus(r=undef, h=99, angle=undef, box=10){ a = -angle; inset = -box/2*((cos(45+a)/sin(45))-1) ; up_set = box/2*((sin(45+a)/sin(45))-1); x = box/2 - inset + r*sin(a); z = r - box/2 - up_set - r*(1-cos(a)); translate([x, 0, z]){ rotate_y(a){ cube([box,99,box], center=true); } } } /* Create a tangent to a cylinder rising in the negative x direction Intended for cutting round-chamfered sections from a block using difference(). The cylinder lies in the y-direction, centred on the origin. This version has the rising chamfer in the negative x-direction, see tangent_to_cylinder_plus() for a rising chamfer in the positive x-direction. ### Example ```example difference(){ cube([20,20,50],center=false); translate_x(6){ hull(){ translate_z(15){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } #tangent_to_cylinder_minus(r=3, angle=30, box=10); } translate_z(5){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } } translate_z(5-3){ translate([-9,-99/2,0]){ cube([9,99,10], center=false); } } } } } ``` :param r: radius of the cylinder to tangent :param h: height of the cylinder to tangent (in y-direction) :param angle: angle, rising to positive x :param box: side length of the box that is tangent to the cylinder */ module tangent_to_cylinder_minus(r=undef, h=99, angle=undef, box=10){ a = angle; inset = - box - box/2*((sin(45+a)/sin(45))-1) + r*sin(a); up_set = box/2*((cos(45+a)/sin(45))-1); x = box/2 + inset; z = r - box/2 - up_set - r*(1-cos(a)); translate([x, 0, z]){ rotate_y(a){ cube([box,99,box], center=true); } } } /* Make a 2-line text message Defaults to a single line if the second line is empty Loading Loading
openscad/libs/main_body_structure.scad +12 −4 Original line number Diff line number Diff line Loading @@ -406,6 +406,8 @@ module xy_legs_and_actuators(params){ cut_depth = (c270_oversize - leg_sep)/2; cut_xy = min(cut_depth, leg_dims(params).x - tiny()) * sin(45); c270_z_space = 22; c270_mid_z = (upper_xy_flex_z(params) - 1) - (c270_z_space + 4)/2; cut_round = 2; // c270 cover rounding radius manual = !(key_lookup("include_motor_lugs", params)); Loading @@ -422,8 +424,9 @@ module xy_legs_and_actuators(params){ leg_frame(params, 135){ leg(params); } translate_z(45){ rounded_cube([c270_oversize, 99, c270_z_space+4], 7, center=true); translate_z(c270_mid_z){ rounding = max(cut_round,5); rounded_cube([c270_oversize, 99, c270_z_space+4], rounding, center=true); } } } Loading @@ -431,8 +434,13 @@ module xy_legs_and_actuators(params){ } if (manual){ // make space for the c270 camera translate_z(45){ rounded_cube([c270_oversize, 99, c270_z_space], 6, center=true); translate_z(c270_mid_z){ rounded_cube([c270_oversize, 99, c270_z_space], cut_round, center=true); reflect_x(){ translate([-(leg_sep/2 + (cut_depth - cut_round)), 0, c270_z_space/2 - cut_round]){ tangent_to_cylinder_plus(r=cut_round, angle=30, box=10); } } } } } Loading
openscad/libs/utilities.scad +112 −0 Original line number Diff line number Diff line Loading @@ -1185,6 +1185,7 @@ module cylinder_to_square_column(d=undef, r=undef, h=undef, transition=undef){ } } /* Create a cube that is rounded on top and flat on the bottom :param dimensions: `[x, y, z]` dimensions of cube Loading Loading @@ -1225,6 +1226,7 @@ module round_top_cube(dimensions, rounding_radius, center=false){ } } /* Create a cube with rounded edges and corners :param dimensions: `[x, y, z]` dimensions of cube Loading Loading @@ -1257,6 +1259,7 @@ module rounded_cube(dimensions, rounding_radius, center=false){ } } /* Create a 2D projection-cut through z=0 or very slightly above. :param shift: If `true` the object is shifted down by `tiny()` before cutting at z=0 Loading @@ -1270,6 +1273,115 @@ module flatten(shift=true){ } /* Create a tangent to a cylinder rising in the positive x direction Intended for cutting round-chamfered sections from a block using difference(). The cylinder lies in the y-direction, centred on the origin. This version has the rising chamfer in the positive x-direction, see tangent_to_cylinder_minus() for a rising chamfer in the negative x-direction. ### Example ```example difference(){ translate_x(-20){ cube([20,20,50],center=false); } translate_x(-6){ hull(){ translate_z(15){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } #tangent_to_cylinder_plus(r=3, angle=30, box=10); } translate_z(5){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } } translate_z(5-3){ translate_y(-99/2){ cube([9,99,10], center=false); } } } } } ``` :param r: radius of the cylinder to tangent :param h: height of the cylinder to tangent (in y-direction) :param angle: angle, rising to positive x :param box: side length of the box that is tangent to the cylinder */ module tangent_to_cylinder_plus(r=undef, h=99, angle=undef, box=10){ a = -angle; inset = -box/2*((cos(45+a)/sin(45))-1) ; up_set = box/2*((sin(45+a)/sin(45))-1); x = box/2 - inset + r*sin(a); z = r - box/2 - up_set - r*(1-cos(a)); translate([x, 0, z]){ rotate_y(a){ cube([box,99,box], center=true); } } } /* Create a tangent to a cylinder rising in the negative x direction Intended for cutting round-chamfered sections from a block using difference(). The cylinder lies in the y-direction, centred on the origin. This version has the rising chamfer in the negative x-direction, see tangent_to_cylinder_plus() for a rising chamfer in the positive x-direction. ### Example ```example difference(){ cube([20,20,50],center=false); translate_x(6){ hull(){ translate_z(15){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } #tangent_to_cylinder_minus(r=3, angle=30, box=10); } translate_z(5){ rotate_x(90){ cylinder(r=3,h=99, center=true, $fn=16); } } translate_z(5-3){ translate([-9,-99/2,0]){ cube([9,99,10], center=false); } } } } } ``` :param r: radius of the cylinder to tangent :param h: height of the cylinder to tangent (in y-direction) :param angle: angle, rising to positive x :param box: side length of the box that is tangent to the cylinder */ module tangent_to_cylinder_minus(r=undef, h=99, angle=undef, box=10){ a = angle; inset = - box - box/2*((sin(45+a)/sin(45))-1) + r*sin(a); up_set = box/2*((cos(45+a)/sin(45))-1); x = box/2 + inset; z = r - box/2 - up_set - r*(1-cos(a)); translate([x, 0, z]){ rotate_y(a){ cube([box,99,box], center=true); } } } /* Make a 2-line text message Defaults to a single line if the second line is empty Loading