/* [Hose thread settings] */ thread_depth = 1.5; thread_width = 2.5; thread_pitch = 5; thread_length = 30; /* [General settings] */ wall_thickness = 3; screw_diam = 6; /* [View settings] */ disable_thread_in_preview = false; tab_width = 30; squish = 1.5; module __sep__() {} disable_thread = $preview && disable_thread_in_preview; // Epsilon. e = $preview ? 2e-2 : 1e-3; $fa = 1; $fs = 1; use ; angle = atan((thread_width * 0.666)/thread_depth/2); echo("angle is", angle); inf = 300; difference() { cylinder(thread_length, d1=41+2*wall_thickness, d2 = 41+2*wall_thickness); translate([0,0,-e]) mirror([1,0,0]) { if (disable_thread) { cylinder(thread_length+e+e, d=41); } else { metric_thread(41, thread_pitch, thread_length+e+e, thread_size=thread_width, angle=angle, groove=true); } } translate([-inf/2, -inf, -inf/2]) cube([inf, inf, inf]); } translate([41/2,-41/2+squish,0]) { cube([wall_thickness, 41/2-squish, thread_length]); difference() { cube([tab_width, wall_thickness, thread_length]); translate([tab_width/2, -e, thread_length/2]) rotate([-90,0,0]) cylinder(h=wall_thickness+e+e, d = 6.5); } } mirror([1,0,0]) translate([41/2,-41/2+squish,0]) { cube([wall_thickness, 41/2-squish, thread_length]); difference() { cube([tab_width, wall_thickness, thread_length]); translate([tab_width/2, -e, thread_length/2]) rotate([-90,0,0]) cylinder(h=wall_thickness+e+e, d = 6.5); } }