← Back to Models
Desktop Trash Bin

Desktop Trash Bin

by Mach3 ·

Small trash bin. change printable part variable to render bin, lid, or assembly, to download separate stl files (do it via editor)

Prompt

design this desktop trash bin (one item)

OpenSCAD Code

// Desktop Trash Bin Simplified - ModelDrift
part = "assembly"; // [bin, lid, assembly]

// Parameters
width = 130;
height = 150;
corner_radius = 25;
wall_thickness = 3;
flute_radius = 2;
flute_spacing = 6;
tolerance = 0.5; // Gap for easy insertion

$fn = 64;

// Render Logic
if (part == "bin") {
    bin_body();
} else if (part == "lid") {
    simple_lid();
} else if (part == "assembly") {
    bin_body();
    // Lift lid slightly for visual clarity in assembly
    translate([0, 0, height - 5]) simple_lid();
}

// --- Modules ---

module bin_body() {
    difference() {
        main_shape(width, height, corner_radius);
        
        // Main hollow interior
        translate([0, 0, wall_thickness])
            main_shape(width - wall_thickness*2, height, corner_radius - wall_thickness);
        
        // Recessed ledge for the lid to sit on
        translate([0, 0, height - 8])
            main_shape(width - wall_thickness + 0.1, 9, corner_radius - wall_thickness/2);
        
        apply_fluting();
    }
}

module simple_lid() {
    lid_thickness = 4;
    plug_depth = 6;
    
    union() {
        // Main top plate (fits into the recessed ledge)
        main_shape(width - wall_thickness - tolerance, lid_thickness, corner_radius - wall_thickness/2);
        
        // Inner plug (fits into the main bin opening)
        translate([0, 0, -plug_depth])
            main_shape(width - wall_thickness*2 - tolerance, plug_depth, corner_radius - wall_thickness);
    }
}

// Helper: Rounded Square Body
module main_shape(w, h, r) {
    offset = w/2 - r;
    hull() {
        translate([offset, offset, 0]) cylinder(h, r, r);
        translate([-offset, offset, 0]) cylinder(h, r, r);
        translate([offset, -offset, 0]) cylinder(h, r, r);
        translate([-offset, -offset, 0]) cylinder(h, r, r);
    }
}

// Helper: Vertical Fluting
module apply_fluting() {
    side_len = width - (corner_radius * 2);
    num_flutes_side = floor(side_len / flute_spacing);
    
    for (r = [0, 90, 180, 270]) {
        rotate([0, 0, r]) {
            // Straight sides
            for (i = [0 : num_flutes_side]) {
                translate([-(side_len/2) + i*flute_spacing, width/2, 10])
                    cylinder(height - 30, flute_radius, flute_radius);
            }
            // Corners
            for (a = [0:10:90]) {
                x = (width/2 - corner_radius) + cos(a) * corner_radius;
                y = (width/2 - corner_radius) + sin(a) * corner_radius;
                translate([x, y, 10])
                    cylinder(height - 30, flute_radius, flute_radius);
            }
        }
    }
}