$fn=64; // --- Parametric Variables --- // Organizer grid configuration rows = 2; // 2 rows: one for nuts, one for matching washers num_sizes = 5; // 5 size categories (e.g., M3, M4, M5, M6, M8) // Compartment dimensions base_width = 20; // Width of the smallest compartment (mm) width_increment = 6; // Width increase for each subsequent size (mm) comp_length = 45; // Front-to-back length of each compartment (mm) comp_height = 18; // Inside depth (mm) // Structural dimensions wall = 2.5; // Wall thickness between compartments (mm) floor_thick = 2; // Base floor thickness (mm) scoop_depth = 18; // Depth of the sloped front scoop for easy retrieval (mm) // --- Calculated Dimensions --- // Calculate overall dimensions based on the arithmetic progression of widths total_width = (num_sizes * base_width) + (((num_sizes - 1) * num_sizes / 2) * width_increment) + ((num_sizes + 1) * wall); total_length = (rows * comp_length) + ((rows + 1) * wall); total_height = comp_height + floor_thick; // Helper functions for positioning function comp_w(col) = base_width + (col * width_increment); function x_offset(col) = col == 0 ? wall : wall + (col * base_width) + (((col - 1) * col / 2) * width_increment) + (col * wall); // --- Main Geometry --- difference() { // Main solid block cube([total_width, total_length, total_height]); // Subtract all compartments for (r = [0 : rows - 1]) { for (c = [0 : num_sizes - 1]) { w = comp_w(c); x = x_offset(c); y = wall + r * (comp_length + wall); z = floor_thick; translate([x, y, z]) { // Compartment with front scoop for easy part retrieval hull() { // Bottom flat area (starts after the scoop) translate([0, scoop_depth, 0]) cube([w, comp_length - scoop_depth, 0.01]); // Top opening (extends slightly above for clean manifold subtraction) translate([0, 0, comp_height]) cube([w, comp_length, 1]); } } } } }