// ========================================== // PARAMETERS // ========================================== // Define variables here for easy global modification length = 45; width = 35; height = 20; wall_thickness = 2.5; gap = 0.25; // Clearance tolerance for 3D printing fitment // ========================================== // EXECUTION // ========================================== // Display the assembly side-by-side base_housing(); translate([length + 15, 0, 0]) snap_fit_lid(); // ========================================== // MODULES // ========================================== // --- Module: base_housing --- // Logic: Solid box MINUS Inner box MINUS Side slot module base_housing() { difference() { // Main outer body cube([length, width, height]); // Internal hollow space (translated to leave wall thickness) translate([wall_thickness, wall_thickness, wall_thickness]) cube([length - 2*wall_thickness, width - 2*wall_thickness, height]); // Wire outlet: A small cutout on the side for cables translate([-1, width/2 - 4, height - 8]) cube([wall_thickness + 2, 8, 10]); } } // --- Module: snap_fit_lid --- // Logic: Flat plate PLUS Inner rim (slightly smaller for gap) module snap_fit_lid() { // The top cover plate cube([length, width, wall_thickness]); // Internal rim dimensions calculated based on walls and gap inner_l = length - 2*wall_thickness - gap; inner_w = width - 2*wall_thickness - gap; // The locking rim that secures the lid to the base translate([wall_thickness + gap/2, wall_thickness + gap/2, wall_thickness]) difference() { // The solid rim block cube([inner_l, inner_w, 4]); // Hollowing the rim to save material translate([1.5, 1.5, -1]) cube([inner_l - 3, inner_w - 3, 6]); } }