// -*- C -*- include tube_dia = 22.4; hinge_around = 2.5; hinge_pin = 1.5; // xxx main_th = 3; minor_wall_min = 1; screw = 5.0 + 0.75; screw_head = 10; // xxx screw_nut_across = 10; // xxx screw_nut_th = 5; // xxx screw_head_h = 5; // xxx knob_behind_across = 15; // xxx behind_knob_th = 5; clamp_width = 20; clamp_gap = 2; lower_th = 1; overlap_l = 0.1; bridge_slop_factor = 1.5; $fs = 0.1; $fa = 5; // calculated main_r = tube_dia/2 + main_th; hinge_outer_r = hinge_around + hinge_pin/2; hinge_y = tube_dia/2 + hinge_outer_r; screw_max_y_lhs = -main_r -screw_nut_across/2; screw_max_y_rhs = -main_r -knob_behind_across/2; screw_y = min(screw_max_y_lhs, screw_max_y_rhs); bot_y = screw_y -max( screw_nut_across, knob_behind_across/2 ) -minor_wall_min; echo(bot_y); module TubePlan(){ circle(r = tube_dia/2); } module HingePinPlan(){ translate([0, hinge_y]) circle(r= hinge_pin/2); } module HingeBodyPlan(){ translate([0, hinge_y]) circle(r= hinge_outer_r); } module TubeClampLeftPlan(){ difference(){ union(){ polygon([[ 0, hinge_y + hinge_outer_r ], [ -main_r + overlap_l, hinge_y + hinge_outer_r ], [ -main_r + overlap_l, bot_y ], [ -clamp_gap/2, bot_y ], [ -clamp_gap/2, 0, ], [ 0, 0, ], ]); HingeBodyPlan(); } TubePlan(); HingePinPlan(); } } module TubeClampLeft() { ////toplevel linextr(-clamp_width/2, clamp_width/2) TubeClampLeftPlan(); } module TubeClampRightPlan(){ difference(){ union(){ rectfromto([ clamp_gap/2, bot_y ], [ clamp_gap/2 + behind_knob_th, 0 ]); intersection(){ circle(r= main_r); union(){ rectfromto([0,0], main_r * [5,5]); rectfromto([ clamp_gap/2, main_r*5 ], main_r * [2,-5]); } } HingeBodyPlan(); } TubePlan(); HingePinPlan(); } } module SomeClamp(){ difference(){ linextr(-clamp_width/2, clamp_width/2) children(0); linextr_x_yz(-main_r*5, main_r*5) translate([screw_y, 0]) circle(r= screw/2); } } module TubeClampLeft() { ////toplevel difference(){ SomeClamp() TubeClampLeftPlan(); translate([0, screw_y, 0]) { linextr_x_yz(-(clamp_gap/2 + screw_nut_th), 0) square([screw_nut_across, screw_nut_across * bridge_slop_factor], center=true); linextr_x_yz(-main_r, -main_r + screw_head_h) square([screw_head, screw_head * bridge_slop_factor], center=true); } } } module TubeClampRight() { ////toplevel SomeClamp() TubeClampRightPlan(); } //TubeClampLeft(); //TubeClampRight();