$fn=64; /* Parametric Variables */ case_width = 56; // Width of the earbuds case case_depth = 24; // Depth of the earbuds case case_height = 40; // Height of the holder pocket wall_thickness = 3; // Wall thickness hex_f2f = 14; // Hex flat-to-flat distance (HSW compatible standard) hex_depth = 10; // Depth of the hex peg cable_cutout = 15; // Diameter of bottom charging cable hole corner_radius = 4; // Outer corner radius // Calculated dimensions outer_w = case_width + wall_thickness * 2; outer_d = case_depth + wall_thickness * 2; outer_h = case_height + wall_thickness; union() { // Main Holder Body difference() { // Outer shape rounded_box(outer_w, outer_d, outer_h, corner_radius); // Inner cavity translate([0, 0, wall_thickness]) rounded_box(case_width, case_depth, outer_h + 1, corner_radius/2); // Front thumb cutout (to easily grab the case) translate([0, outer_d/2, outer_h]) rotate([90, 0, 0]) cylinder(r=case_width/2.5, h=outer_d, center=true); // Bottom cable cutout translate([0, 0, -1]) cylinder(d=cable_cutout, h=wall_thickness + 2); } // Hex Peg (Back attachment) // +0.1 ensures a manifold union with the back wall translate([0, -outer_d/2 + 0.1, outer_h - hex_f2f - 5]) { rotate([90, 0, 0]) { // Main hex peg cylinder(r=hex_f2f / sqrt(3), h=hex_depth, $fn=6); // Standoff / reinforcement collar cylinder(r=(hex_f2f / sqrt(3)) + 1.5, h=2); } } } // Helper module for a Z-extruded rounded box module rounded_box(w, d, h, r) { hull() { for(x = [-w/2+r, w/2-r]) { for(y = [-d/2+r, d/2-r]) { translate([x, y, 0]) cylinder(r=r, h=h); } } } }