include ; eps = 0.01; infty = 200; thin_version = 0; wall = 8; inner_w = 82; outer_w = inner_w + 2*30; inner_w_round_r = 2; body_h = thin_version ? 8 : 30; bottom_w = thin_version ? 35 : 70; top_w = bottom_w + 3*wall; bottom_h = 60; module top_part() { difference() { round_with() { rounding(); hull() { Mx() Tx(outer_w/2 - 4*wall) Sx(2) cylinder(r = 2*wall, h = body_h); } } translate([-outer_w/2-eps, -2*wall-eps, -eps]) cube([outer_w + 2*eps, 2*wall-inner_w_round_r, body_h + 2*eps]); Mx() translate([inner_w/2 + inner_w_round_r, -inner_w_round_r, -eps]) hull() { cylinder(r = inner_w_round_r, h = body_h + 2*eps); cube([inner_w/2, inner_w_round_r, body_h + 2*eps]); } } } hole_d = thin_version ? 20 : 35; hole_l = 1.25*hole_d; hole_xoff = 0.2*(bottom_w-hole_d); hole_yoff = bottom_h - 0.2*hole_d; hole_top_yoff = 7; hole_top_l = thin_version ? 30 : 20; hook_top_rx = thin_version ? 4 : 8; hook_top_ry = thin_version ? 6 : 12; module bottom_part() { difference() { hull() { Tx(-inner_w/2) Ty(-inner_w_round_r) cube([inner_w, wall/2, body_h]); Ty(-bottom_h) cylinder(r = bottom_w/2, h = body_h); } // main hole difference() { hull() { translate([hole_xoff, -hole_yoff, -eps]) cylinder(r = hole_d/2, h = body_h+2*eps); translate([hole_xoff, -hole_yoff-hole_d+hole_l, -eps]) cylinder(r = hole_d/2, h = body_h+2*eps); } // rounded hook inner bottom translate([-inner_w/2, -hole_yoff-hole_d/2, body_h/2]) Sy(0.7) Ry(90) cylinder(r = 0.55*body_h, h = inner_w); } // cut to the top hull() { translate([inner_w/2+inner_w_round_r, -hole_top_l-hole_top_yoff, -eps]) cube([eps, hole_top_l, body_h+2*eps]); translate([hole_xoff, -hole_yoff-hole_d+hole_l, -eps]) intersection() { cylinder(r = hole_d/2, h = body_h+2*eps); translate([-infty, 0, -infty/2]) cube(infty); } } // rounded hook end difference() { translate([hole_xoff, -hole_yoff, -eps]) cube([inner_w/2, hole_l-hole_d/2, body_h+2*eps]); translate([hole_xoff + hole_d/2 + hook_top_rx - 2*eps, -hole_yoff, -2*eps]) Sy(hook_top_ry/hook_top_rx) cylinder(r = hook_top_rx, h = body_h + 4*eps); } } } module rounding() { if (thin_version) { Mz() cylinder(r1 = 2, r2 = 0, h = 3, $fn = 8); } else { Mz() cylinder(r1 = 3, r2 = 0, h = 4.5, $fn = 8); } } $fn = 128; top_part(); // pro prichyceni ABS, ale stejne nefunguje // Mx() Tx(outer_w/2-3) Ty(3) // cylinder(r = 15, h = 0.4); round_with() { rounding(); bottom_part(); } /* // rotate_extrude(angle=360, convexity=10) { outer_d = 1.1*body_h; inner_d = body_h - 1.7*wall; inner_scale = 1.5; hole_depth = 0.01*bottom_h; difference() { difference() { union() { Ty(outer_d/2-eps) square([body_h, bottom_h - outer_d/2 + eps]); intersection() { square(body_h); Tx(body_h/2) Ty(outer_d/2) circle(r = outer_d/2); } } hull() { Tx(body_h) Ty(bottom_h-hole_depth) square([eps, hole_depth]); Tx(wall + inner_d/2) Ty(wall + inner_scale*inner_d/2) Sy(inner_scale) circle(r = inner_d/2); Tx(wall + inner_d/2) Ty(wall + inner_d/2) circle(r = inner_d/2); } } } */