$fn = 64; // --- PARAMETERS --- width = 50; // Total width of the housing height = 65; // Total height of the housing depth = 40; // Total depth of the housing wall = 2; // Wall thickness tol = 0.5; // Clearance tolerance for moving parts pivot_r = 2.5; // Radius of the pivot hinge // Derived parameters inner_w = width - 2*wall; inner_d = depth - wall; inner_h = height - 2*wall; bin_w = inner_w - 2*tol; bin_d = inner_d - 4; // Leave room for the back catch bin_h = inner_h - 2*tol; // Absolute pivot coordinates in the housing pivot_y = wall + 6; pivot_z = wall + 6; // --- LAYOUT --- // Parts are placed side-by-side for easy 3D printing housing(); translate([width + 10, 0, 0]) bin(); // --- MODULES --- module housing() { difference() { // Main body cube([width, depth, height]); // Inner cavity (open front) translate([wall, -1, wall]) cube([inner_w, inner_d + 2, inner_h]); // Pivot holes translate([-1, pivot_y, pivot_z]) rotate([0, 90, 0]) cylinder(r=pivot_r + tol, h=width + 2); } // Top front crossbar (acts as a stop for the tilting bin) translate([wall, 0, height - wall]) cube([inner_w, 5, wall]); } module bin() { // Local pivot coordinates py = pivot_y - wall - tol; pz = pivot_z - wall - tol; bin_radius = height - pivot_z - 1; difference() { union() { // Main bin shape (wedge created by cube/cylinder intersection) intersection() { cube([bin_w, bin_d, bin_h]); translate([-1, py, pz]) rotate([0, 90, 0]) cylinder(r=bin_radius, h=bin_w + 2); } // Catch on top-back to hit the housing roof and stop tilting intersection() { translate([0, bin_d - 4, 0]) cube([bin_w, 4, bin_h]); translate([-1, py, pz]) rotate([0, 90, 0]) cylinder(r=bin_radius + 1.5, h=bin_w + 2); } // Pivot pegs translate([-tol, py, pz]) rotate([0, 90, 0]) cylinder(r=pivot_r, h=bin_w + 2*tol); // Pull handle on the front face translate([bin_w/2 - 10, -wall, bin_h - 20]) hull() { cube([20, wall, 10]); translate([0, -5, 5]) cube([20, 1, 5]); } } // Hollow out the bin uniformly intersection() { translate([wall, wall, wall]) cube([bin_w - 2*wall, bin_d - 2*wall, bin_h]); translate([-1, py, pz]) rotate([0, 90, 0]) cylinder(r=bin_radius - wall, h=bin_w + 2); } // Chamfer bottom front corner to clear the floor when tilting translate([-1, 0, 0]) polyhedron( points=[ [0,0,0], [bin_w+2,0,0], [bin_w+2,3,0], [0,3,0], [0,0,3], [bin_w+2,0,3] ], faces=[ [0,3,2,1], [0,1,5,4], [1,2,5], [0,4,3], [3,4,5,2] ] ); } }