9 pin_gap = 1.5; // around
25 bolt_gap = 1.0; // total, on both sides
27 // ---------- vhook ----------
31 // ---------- cleat ----------
36 cleat_horn_d_min = [10, 12];
37 cleat_horn_d_max = [12, 14];
41 // ---------- hhook ----------
47 // ========== defaults ==========
51 pin_hole_dia = pin_dia/2;
52 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
54 // ========== calculated ==========
58 hole_dia = th + pin_gap;
60 bolt_hole_r = (bolt_dia + bolt_gap)/2;
62 main_r = tube_dia/2 + th;
66 hinge_o_r = 0.5 * hole_dia + th;
68 hinge_x = -0.5 * tube_dia - hinge_o_r;
69 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
70 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
72 flats_y = open_gap/2 + th;
74 stride_z = hinge_unit*2 + hinge_z_gap*2;
75 total_z = hinge_units * stride_z - hinge_z_gap;
80 pin_flatten = pin_dia/2 * (1 - cos(45));
82 bolt_stride = total_z / nbolts;
88 vhook_theta = atan2( smooth_r, main_r );
90 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
91 vhook_ctr = vhook_y0 - vhook_inside/2;
92 vhook_outer_dia = vhook_inside + vhook_th*2;
96 cleat_horn_tl = cleat_horn_l + cleat_stem_l/2;
99 cleat_horn_tl + cleat_horn_d_min[0]/2 - total_z/2
102 // calculated - hhook
104 hhook_outer_dia = hhook_inside + hhook_th*2;
106 hhook_ctr = -max(main_r + hhook_inside/2,
107 tube_dia/2 + hhook_outer_dia/2);
113 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
116 module TubePlan(){ circle(r = tube_dia/2); }
117 module MainCirclePlan(){ circle(r = main_r); }
119 module PlanWeldMainCircle(){
130 rotate(-135) square(100);
134 module MainPlan(flatten=false) {
138 translate([hinge_x, 0]) circle(r= hinge_o_r);
140 rectfromto([0, -flats_y],
144 rectfromto([0, -open_gap/2],
145 [max_x+1, +open_gap/2]);
146 translate([hinge_x, 0]) {
148 circle(r= hole_dia/2);
150 translate([ pin_flatten, 0 ])
151 square(center=true, [hole_dia, hole_dia + 1]);
157 module Portion(d=0) {
158 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
159 rectfromto([hinge_x*2, 0],
160 [max_x+10, -(tube_dia/2+th+10)]);
163 module MainPlanA(flatten){
170 module MainPlanB(flatten){
177 module HalfClampX(flatten=false){
179 translate([0,0, min_z]) {
180 linextr(0, total_z) mirror([0,1]) MainPlanB();
181 for (i=[0 : hinge_units-1]) {
182 translate([0,0, stride_z*i])
183 linextr(0, hinge_unit) MainPlanA(flatten);
186 for (j=[0:nbolts-1]) {
187 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
188 translate([0, -tube_dia/2, 0])
190 cylinder(r= bolt_hole_r, h= tube_dia);
191 translate([0, -flats_y, 0])
193 cylinder(r= bolt_flat/2, h= tube_dia/2);
199 // ---------- vhook ----------
201 module VHookProfile() {
202 translate([0, -vhook_inside/2 - vhook_th/2])
203 circle(r = vhook_th/2);
206 module VHookHookMain(outer=false){ ////toplevel
208 rotate_extrude(convexity=10)
213 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
218 module VHookA(){ ////toplevel
221 translate([0, vhook_ctr, 0]){
224 linextr(-0.1, vhook_outer_dia/2)
226 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
227 sphere(r= vhook_th/2);
232 VHookHookMain(outer=true);
233 linextr_y_xz(0, vhook_outer_dia/2) hull(){
235 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
241 translate([0,0, -vhook_outer_dia])
242 cube(center=true, vhook_outer_dia*2);
246 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
247 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
250 module VHookPlanDemo(){
252 translate([0, vhook_ctr, 5])
255 color("blue") VHookProfile();
259 // ---------- cleat ----------
261 function cleat_frame_theta(s) = s * cleat_horn_tl / cleat_curve_r * 360/TAU;
262 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
263 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
264 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
265 cleat_horn_d_max * (1-s) ) * 0.5;
267 module CleatFrameSphere(r) {
268 scale([1, r[1]/r[0], 1])
272 module CleatFrame(s) {
273 r = cleat_frame_r(s);
274 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
281 for (si=[0 : cleat_frames-2]) {
282 s0 = si / (cleat_frames-1);
283 s1 = (si+1) / (cleat_frames-1);
292 frames = cleat_frames/2;
293 se = cleat_stem_l/2 / cleat_horn_tl;
294 r = cleat_frame_r(se);
297 for (s = [-se, se]) {
298 for (z= [-(cleat_height + tube_dia/2),
300 translate([cleat_frame_x(s), 0, z])
301 linear_extrude(height=0.1)
302 scale([1, r[1]/r[0]])
310 translate([0,0, vcleat_dz]){
312 translate([0, -(main_r + cleat_height), 0]) {
313 rotate([0, -90, 90]) {
322 linextr(-cleat_stem_l, +cleat_stem_l)
323 circle(r = tube_dia/2 + 0.1);
328 module VCleatA(){ ////toplevel
333 // ---------- hhook ----------
335 module HHookHookPlan(){
336 translate([0, hhook_ctr]){
338 circle(r = hhook_outer_dia/2);
339 circle(r = hhook_inside/2);
340 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
341 [0, +hhook_outer_dia]);
343 translate([0, -(hhook_inside/2 + hhook_th/2)]){
345 for (x=[-0.1, hhook_l]) {
346 translate([x,0]) square(center=true, hhook_th);
353 module HHookA(){ ////toplevel
355 linextr(min_z, max_z) {
360 module HHookPlanDemo(){
365 // ---------- misc ----------
367 module PinSitu(){ ////toplevel
370 translate([0,0, -pin_head_th])
371 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
373 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
375 translate([0,0, total_z + pin_tail/2])
377 translate([0,0, -pin_dia])
378 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
379 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
380 cube([50,100, total_z*2]);
384 module Pin(){ ////toplevel
390 module GeneralB(){ ////toplevel
394 module DummyA(){ ////toplevel
398 module PlanDemo(){ ////toplevel
400 translate([0,0,-4]) color("red") Portion(1);
401 translate([0,0,-2]) color("grey") Portion(0);
403 translate([0, tube_dia*1.5]) {
408 translate([0, -tube_dia*1.5]) {
411 translate([tube_dia*4, 0]) {
414 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
417 module DemoA(){ DummyA(); }
419 module Demo(){ ////toplevel
420 color("red") rotate([180,0,0]) GeneralB();
421 color("blue") DemoA();
422 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
423 rotate([0,0,180]) PinSitu();
426 module DemoPair(){ ////toplevel
427 color("red") rotate([180,0,0]) DemoA();
428 color("blue") DemoA();
429 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
430 rotate([0,0,180]) PinSitu();