Rewrite of mount_plate() module into more literate and readable format. Make better use of variables and improve DRY.

This commit is contained in:
mmcwilliams 2023-04-14 16:09:31 -04:00
parent 6a0bfbe8c6
commit 6b24209ca4
2 changed files with 51 additions and 54 deletions

View File

@ -31,8 +31,8 @@ FILTER_VOID_X = FILTER_X - 9 + ((4.5 - 2.34) * 2);
ROLLER_SPACING = 95; ROLLER_SPACING = 95;
module m5_nut () { module m5_nut (pos = [0, 0, 0]) {
hex(9.4, 4); translate(pos) hex(9.4, 4);
} }
module block () { module block () {
@ -53,11 +53,11 @@ module block () {
translate([0, (BY / 2) - 3.5, 0]) { translate([0, (BY / 2) - 3.5, 0]) {
translate([BOLTSX / 2, 0, 0]) { translate([BOLTSX / 2, 0, 0]) {
cylinder(r = 4.95 / 2, h = BZ + 1, center = true, $fn = 50); cylinder(r = 4.95 / 2, h = BZ + 1, center = true, $fn = 50);
translate([0, 0, 3]) m5_nut(); m5_nut([0, 0, 3]);
} }
translate([-BOLTSX / 2, 0, 0]) { translate([-BOLTSX / 2, 0, 0]) {
cylinder(r = 4.95 / 2, h = BZ + 1, center = true, $fn = 50); cylinder(r = 4.95 / 2, h = BZ + 1, center = true, $fn = 50);
translate([0, 0, 3]) m5_nut(); m5_nut([0, 0, 3]);
} }
} }
} }

View File

@ -7,32 +7,12 @@ COUPLING_D = 37;
WASHER_D = 35.7; //1 + 1/3 diameter? WASHER_D = 35.7; //1 + 1/3 diameter?
WASHER_H = 2.4; WASHER_H = 2.4;
MOTOR_SHAFT_D = 6; MOTOR_SHAFT_D = 6; //dep
MOTOR_SHAFT_H = 16; MOTOR_SHAFT_H = 16; //dep
MOTOR_SHAFT_HOBBLE = 1; MOTOR_SHAFT_HOBBLE = 1; //dep
MOTOR_MOUNT_X = 32.5 + 0.1;
MOTOR_MOUNT_Y = 17.5 + 0.1;
M4 = 4.1; M4 = 4.1;
module motor_shaft () {
difference () {
cylinder(r = R(MOTOR_SHAFT_D), h = MOTOR_SHAFT_H, center = true, $fn = 60);
translate([MOTOR_SHAFT_D - MOTOR_SHAFT_HOBBLE, 0, 0]) cube([MOTOR_SHAFT_D, MOTOR_SHAFT_D, MOTOR_SHAFT_H + 1], center = true);
}
}
module motor_mounts () {
Z = 1.5;
D = 7.5;
translate([MOTOR_MOUNT_X / 2, MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
translate([-MOTOR_MOUNT_X / 2, MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
translate([MOTOR_MOUNT_X / 2, -MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
translate([-MOTOR_MOUNT_X / 2, -MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
}
module motor_mount_pad (D, Z) { module motor_mount_pad (D, Z) {
difference () { difference () {
cylinder(r = R(D), h = Z, center = true, $fn = 40); cylinder(r = R(D), h = Z, center = true, $fn = 40);
@ -51,7 +31,7 @@ module magnetic_coupling (MAGNETS = 4, MAGNET_D = 8.1, MAGNET_H = 2.5) {
translate([0, 0, -5]) cylinder(r = R(20), h = 5, center = true, $fn = 60); translate([0, 0, -5]) cylinder(r = R(20), h = 5, center = true, $fn = 60);
} }
//motor shaft void //motor shaft void
scale([1.1, 1.1, 2]) motor_shaft(); scale([1.1, 1.1, 2]) geared_motor_shaft();
//magnet voids //magnet voids
for (i = [0 : MAGNETS - 1]) { for (i = [0 : MAGNETS - 1]) {
rotate([0, 0, i * (360 / MAGNETS)]) { rotate([0, 0, i * (360 / MAGNETS)]) {
@ -113,12 +93,14 @@ module daylight_spool_insert () {
} }
} }
module motor_mount_void (D, Z) { module motor_mount_void (pos = [0, 0, 0], D, Z) {
translate(pos) {
cylinder(r = R(D), h = Z, center = true, $fn = 40); cylinder(r = R(D), h = Z, center = true, $fn = 40);
//bolt void //bolt void
translate([0, 0, 5]) cylinder(r = R(3.25 + 0.2), h = Z + 10, center = true, $fn = 40); translate([0, 0, 5]) cylinder(r = R(3.25 + 0.2), h = Z + 10, center = true, $fn = 40);
translate([0, 0, 4.75]) cylinder(r = R(6), h = 3.5, center = true, $fn = 40); translate([0, 0, 4.75]) cylinder(r = R(6), h = 3.5, center = true, $fn = 40);
} }
}
module mount_plate_void (pos = [0, 0, 0]) { module mount_plate_void (pos = [0, 0, 0]) {
translate(pos) { translate(pos) {
@ -127,6 +109,14 @@ module mount_plate_void (pos = [0, 0, 0]) {
} }
} }
module corner_void (pos = [0, 0, 0], Corner) {
translate(pos) cube([Corner, Corner, 8], center = true);
}
module corner_round (pos = [0, 0, 0], D) {
translate(pos) cylinder(r = D, h = 7, center = true, $fn = 40);
}
module mount_plate () { module mount_plate () {
Z = 1.5; Z = 1.5;
D = 7.5 + 1.5; D = 7.5 + 1.5;
@ -134,12 +124,17 @@ module mount_plate () {
X = 60; X = 60;
Y = 60; Y = 60;
MOUNT_X = 42; PlateMountX = 42 / 2;
MOUNT_Y = 42; PlateMountY = 42 / 2;
CORNER = 3; Corner = 3;
X_CORNER = (X / 2) - (CORNER / 2); CornerHalf = Corner / 2;
Y_CORNER = (Y / 2) - (CORNER / 2); CornerX = (X / 2) - (Corner / 2);
CornerY = (Y / 2) - (Corner / 2);
CornerZ = 3.26 - .5;
MotorMountX = (GearedMotorMountX + 0.1) / 2;
MotorMountY = (GearedMotorMountY + 0.1) / 2;
//center //center
//color("red") cylinder(r = 15 / 2, h = 20, center = true, $fn = 60); //color("red") cylinder(r = 15 / 2, h = 20, center = true, $fn = 60);
@ -150,29 +145,31 @@ module mount_plate () {
//motor void (centered) //motor void (centered)
translate([7-0.5, 0, 0]) { translate([7-0.5, 0, 0]) {
translate([-(46 / 2) + 15 + 1 + 0.5, 0, 0]) cylinder(r = R(15), h = 20, center = true, $fn = 60); translate([-(46 / 2) + 15 + 1 + 0.5, 0, 0]) cylinder(r = R(15), h = 20, center = true, $fn = 60);
translate([(MOTOR_MOUNT_X / 2)+1, (MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z); translate([1, 0, 0]) {
translate([-(MOTOR_MOUNT_X / 2)+1, (MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z); motor_mount_void([MotorMountX, MotorMountY, 0], D, Z);
translate([(MOTOR_MOUNT_X / 2)+1, -(MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z); motor_mount_void([-MotorMountX, MotorMountY, 0], D, Z);
translate([-(MOTOR_MOUNT_X / 2)+1, -(MOTOR_MOUNT_Y / 2), 0]) motor_mount_void(D, Z); motor_mount_void([MotorMountX, -MotorMountY, 0], D, Z);
motor_mount_void([-MotorMountX, -MotorMountY, 0], D, Z);
}
//pad void //pad void
translate([-8 + 12.5 + 1, 0, 0]) cube([8, 17, Z], center = true); translate([-8 + 12.5 + 1, 0, 0]) cube([8, 17, Z], center = true);
} }
mount_plate_void([MOUNT_X / 2, MOUNT_Y / 2, 0]); mount_plate_void([PlateMountX, PlateMountY, 0]);
mount_plate_void([-MOUNT_X / 2, MOUNT_Y / 2, 0]); mount_plate_void([-PlateMountX, PlateMountY, 0]);
mount_plate_void([MOUNT_X / 2, -MOUNT_Y / 2, 0]); mount_plate_void([PlateMountX, -PlateMountY, 0]);
mount_plate_void([-MOUNT_X / 2,-MOUNT_Y / 2, 0]); mount_plate_void([-PlateMountX, -PlateMountY, 0]);
translate([X_CORNER, Y_CORNER, 3.26 - .5]) cube([CORNER, CORNER, 8], center = true); corner_void([CornerX, CornerY, CornerZ], Corner);
translate([-X_CORNER, Y_CORNER, 3.26 - .5]) cube([CORNER, CORNER, 8], center = true); corner_void([-CornerX, CornerY, CornerZ], Corner);
translate([X_CORNER, -Y_CORNER, 3.26 - .5]) cube([CORNER, CORNER, 8], center = true); corner_void([CornerX, -CornerY, CornerZ], Corner);
translate([-X_CORNER, -Y_CORNER, 3.26 - .5]) cube([CORNER, CORNER, 8], center = true); corner_void([-CornerX, -CornerY, CornerZ], Corner);
} }
translate([X_CORNER - (CORNER / 2), Y_CORNER - (CORNER / 2), 3.26 - .5]) cylinder(r = CORNER, h = 7, center = true, $fn = 40); corner_round([CornerX - CornerHalf, CornerY - CornerHalf, CornerZ], Corner);
translate([-X_CORNER + (CORNER / 2), Y_CORNER - (CORNER / 2), 3.26 - .5]) cylinder(r = CORNER, h = 7, center = true, $fn = 40); corner_round([-CornerX + CornerHalf, CornerY- CornerHalf, CornerZ], Corner);
translate([X_CORNER - (CORNER / 2), -Y_CORNER + (CORNER / 2), 3.26 - .5]) cylinder(r = CORNER, h = 7, center = true, $fn = 40); corner_round([CornerX - CornerHalf, -CornerY + CornerHalf, CornerZ], Corner);
translate([-X_CORNER + (CORNER / 2), -Y_CORNER + (CORNER / 2), 3.26 - .5]) cylinder(r = CORNER, h = 7, center = true, $fn = 40); corner_round([-CornerX + CornerHalf, -CornerY + CornerHalf, CornerZ], Corner);
} }
//centered, minimal geometry needed to add //centered, minimal geometry needed to add