$fn=64; // --- Parameters --- shelf_width = 200; shelf_depth = 100; shelf_height = 25; wall_thickness = 4; clearance = 0.5; // --- Derived Parameters --- cavity_w = shelf_width - 2 * wall_thickness; cavity_h = shelf_height - 2 * wall_thickness; cavity_d = shelf_depth - wall_thickness; bracket_w = cavity_w - 2 * clearance; bracket_h = cavity_h - 2 * clearance; bracket_d = cavity_d - clearance; // --- Print Layout --- // Shelf (Oriented with the cavity facing up for support-free printing) translate([0, shelf_height, 0]) rotate([90, 0, 0]) shelf_body(); // Bracket (Oriented with the backplate flat on the bed) translate([0, shelf_height + 30, 0]) rotate([90, 0, 0]) bracket(); // --- Modules --- module shelf_body() { difference() { // Main outer shape hull() { // Front rounded corners translate([5, shelf_depth - 5, 0]) cylinder(r=5, h=shelf_height); translate([shelf_width - 5, shelf_depth - 5, 0]) cylinder(r=5, h=shelf_height); // Back flat edge cube([shelf_width, 1, shelf_height]); } // Inner cavity for the bracket // Cut starts exactly at the back (y=0) and goes deep into the shelf translate([wall_thickness, -0.1, wall_thickness]) cube([cavity_w, cavity_d + 0.1, cavity_h]); } } module bracket() { difference() { union() { // Wall mounting plate cube([bracket_w, 8, bracket_h]); // Left support prong cube([15, bracket_d, bracket_h]); // Right support prong translate([bracket_w - 15, 0, 0]) cube([15, bracket_d, bracket_h]); // Center support prong translate([bracket_w / 2 - 7.5, 0, 0]) cube([15, bracket_d, bracket_h]); } // Counterbored screw holes for wall mounting for(x = [bracket_w / 4, 3 * bracket_w / 4]) { translate([x, -1, bracket_h / 2]) rotate([-90, 0, 0]) { // Main screw hole cylinder(r=2.5, h=10); // Counterbore for screw head (recessed inside the bracket) translate([0, 0, 5]) cylinder(r=5, h=5); } } } }