/* [Knob Dimensions] */ outer_diameter = 30; // [20:1:60] total_height = 14; // [8:1:30] top_fillet_radius = 2.0; // [0.5:0.5:5] knurl_depth = 0.75; // [0.3:0.05:1.5] knurl_count = 42; // [20:2:80] knurl_helix_angle = 45; // [30:5:60] /* [Nut & Bolt Dimensions] */ bolt_diameter = 6.5; // [3:0.1:12] hex_nut_flats = 10.0; // [5:0.1:20] hex_nut_depth = 5.0; // [2:0.5:15] /* [Finishing & Aesthetics] */ knob_color = "DimGray"; nut_preview = true; nut_color = "Gold"; $fn = 72; // Calculated values radius = outer_diameter / 2; // Across flats (W) to across corners (C) for a regular hexagon: C = W / cos(30) = W * 2 / sqrt(3) hex_nut_radius = (hex_nut_flats / 2) / cos(30); // Knurl twist angle based on height and circumference for the chosen helix angle circumference = 3.14159265 * outer_diameter; twist_deg = (total_height * tan(knurl_helix_angle) / circumference) * 360; module knurl_profile_2d() { polygon([ for (i = [0 : 2 * knurl_count - 1]) let( angle = i * 180 / knurl_count, r = (i % 2 == 0) ? radius : (radius - knurl_depth) ) [r * cos(angle), r * sin(angle)] ]); } module diamond_knurl_cylinder(h) { slices = ceil(h * 3); intersection() { linear_extrude(height = h, twist = twist_deg, slices = slices, convexity = 10) knurl_profile_2d(); linear_extrude(height = h, twist = -twist_deg, slices = slices, convexity = 10) knurl_profile_2d(); } } module top_rounding_cutter() { // Cutter to round over the top outside corner of the knob difference() { translate([0, 0, total_height - top_fillet_radius]) cylinder(r = radius + 2, h = top_fillet_radius + 1); translate([0, 0, total_height - top_fillet_radius]) rotate_extrude($fn = 72) translate([radius - top_fillet_radius, 0, 0]) circle(r = top_fillet_radius, $fn = 36); cylinder(r = radius - top_fillet_radius, h = total_height + 2); } } module thumb_knob() { difference() { // Main body with knurling diamond_knurl_cylinder(total_height); // Top fillet cutter top_rounding_cutter(); // Central through-hole for bolt translate([0, 0, -1]) cylinder(d = bolt_diameter, h = total_height + 2, $fn = 48); // Hex pocket underneath translate([0, 0, -0.1]) cylinder(r = hex_nut_radius, h = hex_nut_depth + 0.1, $fn = 6); } } // Render the knob color(knob_color) thumb_knob(); // Optional preview of the M6 nut seated in the socket if (nut_preview) { color(nut_color) translate([0, 0, 0.05]) difference() { cylinder(r = hex_nut_radius - 0.1, h = hex_nut_depth - 0.1, $fn = 6); translate([0, 0, -0.5]) cylinder(d = 6, h = hex_nut_depth + 1, $fn = 36); } }