$fn = 64; // --- Parameters --- pen_hole_diameter = 14; // Inner diameter of the cup wall_thickness = 2.5; // Thickness of the cup walls cup_height = 50; // Total height of the pen cup // Hexagon plug settings (default fits Honeycomb Storage Wall) hex_flat_to_flat = 19.8; // Flat-to-flat distance (slightly undersized for fit) hex_depth = 8; // Depth of the hex plug into the wall standoff_length = 4; // Distance between wall and cup // --- Derived Variables --- cup_outer_dia = pen_hole_diameter + (wall_thickness * 2); hex_radius = hex_flat_to_flat / sqrt(3); attachment_z = cup_height - 15; // --- Main Assembly --- difference() { union() { // Cup Exterior translate([0, standoff_length + cup_outer_dia/2, 0]) cylinder(d=cup_outer_dia, h=cup_height); // Hex Plug (pointing into the wall, -Y direction) translate([0, 0, attachment_z]) rotate([90, 0, 0]) rotate([0, 0, 30]) union() { // Main hex body cylinder(r=hex_radius, h=hex_depth - 1, $fn=6); // Chamfer for easy insertion translate([0, 0, hex_depth - 1]) cylinder(r1=hex_radius, r2=hex_radius - 1, h=1, $fn=6); } // Standoff / Connector hull() { // Hex base at wall (Y=0) translate([0, 0, attachment_z]) rotate([90, 0, 0]) rotate([0, 0, 30]) cylinder(r=hex_radius, h=0.1, $fn=6); // Cup attachment body translate([0, standoff_length + cup_outer_dia/2, attachment_z]) cylinder(d=cup_outer_dia, h=hex_flat_to_flat, center=true); } } // Cup Interior (Hole) // Carved out after union to ensure a perfectly clean interior translate([0, standoff_length + cup_outer_dia/2, wall_thickness]) cylinder(d=pen_hole_diameter, h=cup_height + 1); }