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 cleat_overlap = (1-cos(60));
43 // ---------- hhook ----------
49 // ---------- linear bracket ----------
51 linear_bracket_h = 50;
52 linear_bracket_l = 1000;
54 // ========== defaults ==========
58 pin_hole_dia = pin_dia/2;
59 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
61 // ========== calculated ==========
65 hole_dia = th + pin_gap;
67 bolt_hole_r = (bolt_dia + bolt_gap)/2;
69 main_r = tube_dia/2 + th;
73 hinge_o_r = 0.5 * hole_dia + th;
75 hinge_x = -0.5 * tube_dia - hinge_o_r;
76 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
77 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
79 flats_y = open_gap/2 + th;
81 stride_z = hinge_unit*2 + hinge_z_gap*2;
82 total_z = hinge_units * stride_z - hinge_z_gap;
87 pin_flatten = pin_dia/2 * (1 - cos(45));
89 bolt_stride = total_z / nbolts;
95 vhook_theta = atan2( smooth_r, main_r );
97 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
98 vhook_ctr = vhook_y0 - vhook_inside/2;
99 vhook_outer_dia = vhook_inside + vhook_th*2;
101 // calculated - cleat
103 cleat_horn_tl = cleat_horn_l + cleat_stem_l/2;
107 + cleat_horn_d_min[0]/2
108 - cleat_horn_d_min[0]/2 * cleat_overlap
112 // calculated - hhook
114 hhook_outer_dia = hhook_inside + hhook_th*2;
116 hhook_ctr = -max(main_r + hhook_inside/2,
117 tube_dia/2 + hhook_outer_dia/2);
123 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
126 module TubePlan(){ circle(r = tube_dia/2); }
127 module MainCirclePlan(){ circle(r = main_r); }
129 module PlanWeldMainCircle(){
140 rotate(-135) square(100);
144 module MainPlan(flatten=false) {
148 translate([hinge_x, 0]) circle(r= hinge_o_r);
150 rectfromto([0, -flats_y],
154 rectfromto([0, -open_gap/2],
155 [max_x+1, +open_gap/2]);
156 translate([hinge_x, 0]) {
158 circle(r= hole_dia/2);
160 translate([ pin_flatten, 0 ])
161 square(center=true, [hole_dia, hole_dia + 1]);
167 module Portion(d=0) {
168 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
169 rectfromto([hinge_x*2, 0],
170 [max_x+10, -(tube_dia/2+th+10)]);
173 module MainPlanA(flatten){
180 module MainPlanB(flatten){
187 module HalfClampXPositive(flatten=false){
188 translate([0,0, min_z]) {
189 linextr(0, total_z) mirror([0,1]) MainPlanB();
190 for (i=[0 : hinge_units-1]) {
191 translate([0,0, stride_z*i])
192 linextr(0, hinge_unit) MainPlanA(flatten);
197 module HalfClampXNegative(){
198 for (j=[0:nbolts-1]) {
199 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
200 translate([0, -tube_dia/2, 0])
202 cylinder(r= bolt_hole_r, h= tube_dia);
203 translate([0, -flats_y, 0])
205 cylinder(r= bolt_flat/2, h= tube_dia/2);
210 module HalfClampX(flatten=false){
212 HalfClampXPositive(flatten);
213 HalfClampXNegative();
217 // ---------- vhook ----------
219 module VHookProfile() {
220 translate([0, -vhook_inside/2 - vhook_th/2])
221 circle(r = vhook_th/2);
224 module VHookHookMain(outer=false){ ////toplevel
226 rotate_extrude(convexity=10)
231 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
236 module VHookA(){ ////toplevel
239 translate([0, vhook_ctr, 0]){
242 linextr(-0.1, vhook_outer_dia/2)
244 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
245 sphere(r= vhook_th/2);
250 VHookHookMain(outer=true);
251 linextr_y_xz(0, vhook_outer_dia/2) hull(){
253 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
259 translate([0,0, -vhook_outer_dia])
260 cube(center=true, vhook_outer_dia*2);
264 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
265 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
268 module VHookPlanDemo(){
270 translate([0, vhook_ctr, 5])
273 color("blue") VHookProfile();
277 // ---------- cleat ----------
279 function cleat_frame_theta(s) = s * cleat_horn_tl / cleat_curve_r * 360/TAU;
280 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
281 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
282 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
283 cleat_horn_d_max * (1-s) ) * 0.5;
285 module CleatFrameSphere(r) {
286 scale([1, r[1]/r[0], 1])
290 module CleatFrame(s) {
291 r = cleat_frame_r(s);
292 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
299 for (si=[0 : cleat_frames-2]) {
300 s0 = si / (cleat_frames-1);
301 s1 = (si+1) / (cleat_frames-1);
310 frames = cleat_frames/2;
311 se = cleat_stem_l/2 / cleat_horn_tl;
312 r = cleat_frame_r(se);
315 for (s = [-se, se]) {
316 for (z= [-(cleat_height + tube_dia/2),
318 translate([cleat_frame_x(s), 0, z])
319 linear_extrude(height=0.1)
320 scale([1, r[1]/r[0]])
329 translate([0,0, vcleat_dz]){
331 translate([0, -(main_r + cleat_height), 0]) {
332 rotate([0, -90, 90]) {
341 linextr(-cleat_stem_l, +cleat_stem_l)
342 circle(r = tube_dia/2 + 0.1);
345 translate([0,0, total_z * 0.5])
347 (main_r + cleat_stem_l)*4 * [1,1,0] +
352 module VCleatA(){ ////toplevel
357 // ---------- hhook ----------
359 module HHookHookPlan(){
360 translate([0, hhook_ctr]){
362 circle(r = hhook_outer_dia/2);
363 circle(r = hhook_inside/2);
364 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
365 [0, +hhook_outer_dia]);
367 translate([0, -(hhook_inside/2 + hhook_th/2)]){
369 for (x=[-0.1, hhook_l]) {
370 translate([x,0]) square(center=true, hhook_th);
377 module HHookA(){ ////toplevel
379 linextr(min_z, max_z) {
384 module HHookPlanDemo(){
389 // ---------- linear bracket ----------
391 module LinearBracketA(){ ////toplevel
394 HalfClampXPositive();
395 linextr_y_xz(-open_gap/2 - 1, -open_gap/2)
397 rectfromto([0, min_z],
398 [max_x + linear_bracket_l, min_z + linear_bracket_h]);
400 HalfClampXNegative();
406 // ---------- misc ----------
408 module PinSitu(){ ////toplevel
411 translate([0,0, -pin_head_th])
412 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
414 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
416 translate([0,0, total_z + pin_tail/2])
418 translate([0,0, -pin_dia])
419 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
420 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
421 cube([50,100, total_z*2]);
425 module Pin(){ ////toplevel
431 module GeneralB(){ ////toplevel
435 module DummyA(){ ////toplevel
439 module PlanDemo(){ ////toplevel
441 translate([0,0,-4]) color("red") Portion(1);
442 translate([0,0,-2]) color("grey") Portion(0);
444 translate([0, tube_dia*1.5]) {
449 translate([0, -tube_dia*1.5]) {
452 translate([tube_dia*4, 0]) {
455 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
458 module DemoA(){ DummyA(); }
460 module Demo(){ ////toplevel
461 color("red") rotate([180,0,0]) GeneralB();
462 color("blue") DemoA();
463 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
464 rotate([0,0,180]) PinSitu();
467 module DemoPair(){ ////toplevel
468 color("red") rotate([180,0,0]) DemoA();
469 color("blue") DemoA();
470 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
471 rotate([0,0,180]) PinSitu();