// ####################################################### // ###################### Mechanics ###################### // ####################################################### rail_mount_wall = 5; rail_mount_len = 10; rail_mount_block = 22; rail_dia = 8; rail_y_off_1 = 10; cutout_width = 0.5; rail_mount_height = rail_y_off_1 + 6; rail_y_off = rail_dia / 2 + rail_y_off_1; draw_rail_mount = false; // ####################################################### if (draw_rail_mount) rail_mount(30, 20); module rail_mount(slot, rail_mount_len = rail_mount_len) { $fn = 20; echo(rail_mount_len=rail_mount_len); difference() { union() { // main body cube([rail_mount_wall, rail_mount_len, 2 * slot]); // rail clamp translate([rail_mount_wall, 0, ((2 * slot) - rail_mount_block ) / 2]) cube([rail_mount_height, rail_mount_len, rail_mount_block]); } // M4 slot mounting holes translate([-1, rail_mount_len / 2, slot / 2]) rotate([0, 90, 0]) cylinder(d = 4.2, h = rail_mount_wall + 2); translate([-1, rail_mount_len / 2, slot * 3 / 2]) rotate([0, 90, 0]) cylinder(d = 4.2, h = rail_mount_wall + 2); translate([rail_dia / 2 + rail_y_off_1, -1, slot]) rotate([-90, 0, 0]) cylinder(d = rail_dia + 0.1, h = rail_mount_len + 2); // clamping cutout translate([rail_y_off_1 + (rail_dia - cutout_width) / 2, -1, ((2 * slot) - (rail_mount_block + 2)) / 2]) cube([cutout_width, rail_mount_len + 2, rail_mount_block + 2]); translate([-1, rail_mount_len / 2, slot + rail_mount_block / 3]) rotate([0, 90, 0]) { cylinder(d = 3.2, h = rail_mount_height + rail_mount_wall + 2); cylinder(d = 6.1, h = 3.8, $fn = 6); translate([0, 0, rail_mount_height + rail_mount_wall -2.5]) cylinder(d = 6.1, h = 3.8); } translate([-1, rail_mount_len / 2, slot - rail_mount_block / 3]) rotate([0, 90, 0]) { cylinder(d = 3.2, h = rail_mount_height + rail_mount_wall + 2); cylinder(d = 6.1, h = 3.8, $fn = 6); translate([0, 0, rail_mount_height + rail_mount_wall -2.5]) cylinder(d = 6.1, h = 3.8); } translate([-10, -10, -22]) cube([30, rail_mount_len + 20, 30]); translate([-10, -10, 2 * slot - 8]) cube([30, rail_mount_len + 20, 30]); } }