// -*- C -*- opening_height = 7.84 - 0.3 + 0.60; opening_depth = 6.0; // 7.88; openingcnr_dia = 2.75; opening_topprotr = 1.54; gap = 0.25; retain_rad = 1.65; retain_protr = 0.35; retain_hgap_adjust = 1.5; retain_stalk_len = 8.0; retain_stalk_h = 1.5; retain_bend_gap = 2.0; retain_empir_angle = -10; retain_pushmore_adj = 0.0; hgap_empir_adjust = -0.5 -2.50; topprotr_rad = 0.35; bot_overlap = 4; bot_w = 3; handle_w = 10; handle_rh = 3; handle_rcut = 3; cutout_gap = 1.5; total_len = 40; retain_len = 8; basics_len = 8; overret_hch = 5; peg_width_slop = 0.5; peg_inner_thick = 1.0; // calculated ins_irad = openingcnr_dia/2 + gap; ins_orad = openingcnr_dia/2 + opening_height - gap; ins_th = ins_orad - ins_irad; handle_x0 = ins_irad + hgap_empir_adjust; handle_h = bot_overlap + ins_th; handle_y0 = -ins_orad-bot_overlap; handle_y1 = handle_y0 + handle_h; handle_x1 = handle_x0 + bot_w + handle_w; topprotr_y = -ins_irad + opening_topprotr; retain_mxy = [handle_x0 - retain_rad - retain_hgap_adjust, -ins_orad + retain_rad - retain_protr]; retain_cutout_h = retain_rad * 2 + retain_bend_gap; overret_gaplen = retain_cutout_h / cos(retain_empir_angle); peg_width = retain_stalk_len - (handle_x0 - retain_mxy[0]) / cos(retain_empir_angle) - peg_width_slop; peg_height = retain_cutout_h - (retain_rad + retain_stalk_h) + retain_pushmore_adj; retain1_len = retain_len + retain_stalk_len; retain1_base = total_len - retain1_len; module InsertSection(){ hull(){ translate([-ins_irad, -ins_irad]) mirror([1, 0]) square([opening_depth - ins_irad, 0.1]); translate([-ins_irad - topprotr_rad, topprotr_y - topprotr_rad]) circle(r=topprotr_rad, $fn=10); } translate([0, -ins_orad]) square([ins_irad+1, ins_th]); intersection(){ translate([0, -ins_irad]) mirror([1,1]) square([100, opening_depth]); difference(){ circle(r= ins_orad); circle(r= ins_irad, $fn=20); } } } module HandleSection(){ difference(){ hull(){ translate([handle_x0, handle_y0]) square([bot_w, handle_h]); for (y= [handle_y1 - handle_rh/2, handle_y1 - ins_th + handle_rh/2]) { translate([handle_x1 - handle_rh/2, y]) circle(r= handle_rh/2, $fn=20); } } hull(){ for (x= [handle_x0 + bot_w + handle_rcut/2, handle_x1 - handle_rh/2 - handle_rcut/2]) { translate([x, handle_y1]) circle(r = handle_rcut/2, $fn=20); } } } hull(){ for (y= [handle_y1 - handle_rh/2, handle_y1 - 3*handle_rh/2]) translate([handle_x1 - handle_rh/2, y]) circle(r = handle_rh/2, $fn=20); } translate([ handle_x1 - handle_rh*2, handle_y1 - handle_rh/2 ]) circle(r = handle_rh/2, $fn=20); } module RetainSection(){ translate(retain_mxy) { rotate(retain_empir_angle) { circle(r=retain_rad, $fn=20); translate([0, -retain_pushmore_adj]) square([retain_stalk_len + 1, retain_stalk_h]); } } } module PegSection(delta){ hull(){ square([0.1, peg_height + delta]); translate([peg_width - 0.1, peg_height/2 - peg_inner_thick/2]) square([0.1, peg_inner_thick]); } } module PegSectionForDemo(delta){ translate(retain_mxy) rotate(retain_empir_angle) translate([retain_stalk_len - peg_width - peg_width_slop/2, retain_stalk_h - retain_pushmore_adj]) PegSection(delta); } module RetainCutout(gapping=false){ translate(retain_mxy) { rotate(retain_empir_angle) { translate([-50, -retain_rad]) { square([50 + retain_stalk_len, retain_cutout_h]); } } } } module GappingSection(){ difference(){ union(){ InsertSection(); HandleSection(); } RetainCutout(true); } } module WithRetainSection(){ difference(){ union(){ InsertSection(); HandleSection(); } RetainCutout(); } RetainSection(); } module BasicSection(){ InsertSection(); HandleSection(); } module Handle(){ bs1 = retain_len + overret_gaplen + 4; translate([0,0,0]) linear_extrude(height= retain_len) WithRetainSection(); translate([0,0, bs1]) linear_extrude(height= basics_len) BasicSection(); translate([0,0, bs1+0.1]) mirror([0,0,1]) { intersection_for (sl=[0,1]) { multmatrix([[1,0,0,0], [0,1,sl,0], [0,0,1,0], [0,0,0,1]]) linear_extrude(height= overret_gaplen + 10, convexity=100) BasicSection(); } } linear_extrude(height=total_len, convexity=100) GappingSection(); translate([0,0, retain1_base]) { intersection(){ linear_extrude(height=retain1_len, convexity=100) WithRetainSection(); translate([retain_mxy[0], retain_mxy[1], 0]) rotate([0,0, retain_empir_angle]) translate([retain_stalk_len, -30, 0]) multmatrix([[1,0,-1,0], [0,1,0,0], [0,0,1,0], [0,0,0,1]]) cube([50, 60, 50]); } } } module Demo(){ color("red") translate([0,0,-3]) BasicSection(); color("blue") translate([0,0,3]) WithRetainSection(); color("orange") translate([0,0,7]) PegSectionForDemo(0); } module Test(){ linear_extrude(height=2) { WithRetainSection(); translate([0, -handle_y0 + topprotr_y + 10]) BasicSection(); } } Demo(); //HandleSection(); //InsertSection(); //WithRetainSection(); //BasicSection(); //GappingSection(); //Test(); //Demo(); //Handle();