$fn = 64; // --- Parameters --- hex_size = 20; // Flat-to-flat distance for standard hex wall (e.g., HSW) tolerance = 0.2; // Tolerance for a snug fit hex_depth = 8; // Depth of the hex plug front_width = 60; // Width of the front earbud holder plate front_height = 32; // Height of the front plate front_thickness = 10; // Thickness of the front plate spool_radius = 8; // Radius of the cable wrap spool spool_height = 15; // Height of the cable wrap area base_radius = 20; // Radius of the back plate base_thickness = 3; // Thickness of the back plate cavity_radius = 8.5; // Radius of the earbud head cavity stem_radius = 4.5; // Radius of the earbud stem cavity cavity_depth = 8; // Depth of the earbud cavities slot_width = 3; // Width of the wire slot // --- Derived Values --- hex_r = ((hex_size - tolerance) / 2) / cos(30); chamfer_height = base_radius - spool_radius; // --- Modules --- module pill(w, h, d) { hull() { translate([-w/2 + h/2, 0, 0]) cylinder(r=h/2, h=d); translate([w/2 - h/2, 0, 0]) cylinder(r=h/2, h=d); } } // --- Main Model --- // Designed to print face-down (Z=0 on the build plate) without supports difference() { union() { // Front Plate pill(front_width, front_height, front_thickness); // Central Spool translate([0, 0, front_thickness]) cylinder(r=spool_radius, h=spool_height); // 45-degree Chamfer (Support-free bridge to base plate) translate([0, 0, front_thickness + spool_height]) cylinder(r1=spool_radius, r2=base_radius, h=chamfer_height); // Base Plate translate([0, 0, front_thickness + spool_height + chamfer_height]) cylinder(r=base_radius, h=base_thickness); // Hex Plug (Rotated 30 deg for standard vertical orientation) translate([0, 0, front_thickness + spool_height + chamfer_height + base_thickness]) rotate([0, 0, 30]) union() { cylinder(r=hex_r, h=hex_depth - 1, $fn=6); translate([0, 0, hex_depth - 1]) cylinder(r1=hex_r, r2=hex_r - 1, h=1, $fn=6); } } // Left Earbud Cavity & Slot hull() { translate([-15, 3, -1]) cylinder(r=cavity_radius, h=cavity_depth + 1); translate([-15, -8, -1]) cylinder(r=stem_radius, h=cavity_depth + 1); } translate([-15 - slot_width/2, -front_height/2 - 1, -1]) cube([slot_width, front_height/2, front_thickness + 2]); // Right Earbud Cavity & Slot hull() { translate([15, 3, -1]) cylinder(r=cavity_radius, h=cavity_depth + 1); translate([15, -8, -1]) cylinder(r=stem_radius, h=cavity_depth + 1); } translate([15 - slot_width/2, -front_height/2 - 1, -1]) cube([slot_width, front_height/2, front_thickness + 2]); }