$fn = 64; // --- Parameters --- num_slots = 7; // 7 days of the week slot_width = 22; // Internal width of each slot (X) slot_length = 30; // Internal length of each slot (Y) slot_depth = 18; // Internal depth of each slot (Z) wall = 3; // Wall thickness lid_thickness = 2; // Thickness of the sliding lid tolerance = 0.5; // Clearance for sliding fit groove = 1.5; // Depth of the sliding groove // --- Calculated Dimensions --- tray_width = (slot_width * num_slots) + (wall * (num_slots + 1)); tray_length = slot_length + (wall * 2); tray_height = wall + slot_depth + lid_thickness + tolerance + wall; days = ["M", "T", "W", "T", "F", "S", "S"]; // --- Tray Module --- module tray() { difference() { // Main body cube([tray_width, tray_length, tray_height]); for (i = [0 : num_slots - 1]) { // Hollow out the daily slots translate([wall + i * (slot_width + wall), wall, wall]) cube([slot_width, slot_length, tray_height]); // Debossed day letters on the front wall translate([wall + i * (slot_width + wall) + (slot_width / 2), 1.1, tray_height / 2]) rotate([90, 0, 0]) linear_extrude(2) text(days[i], size=slot_width * 0.45, halign="center", valign="center", font="sans-serif:style=Bold"); } // Sliding lid track (groove) // Starts from x=-1, stops at the inside of the right wall translate([-1, wall - groove, wall + slot_depth]) cube([tray_width - wall + 1, slot_length + (groove * 2), lid_thickness + tolerance]); // Cutout top lip on the left side to allow lid insertion translate([-1, wall - groove, wall + slot_depth]) cube([wall + 1, slot_length + (groove * 2), tray_height]); } } // --- Lid Module --- module lid() { lid_width = tray_width - wall - tolerance; lid_length = slot_length + (groove * 2) - tolerance; union() { // Main lid flat cube([lid_width, lid_length, lid_thickness]); // End cap / Grip (fills the entrance cutout and serves as a handle) translate([0, 0, lid_thickness]) cube([wall - tolerance, lid_length, wall]); } } // --- Render --- tray(); // Render lid next to the tray for easy 3D printing translate([0, tray_length + 10, 0]) lid();