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 // ========== defaults ==========
53 pin_hole_dia = pin_dia/2;
54 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
56 // ========== calculated ==========
60 hole_dia = th + pin_gap;
62 bolt_hole_r = (bolt_dia + bolt_gap)/2;
64 main_r = tube_dia/2 + th;
68 hinge_o_r = 0.5 * hole_dia + th;
70 hinge_x = -0.5 * tube_dia - hinge_o_r;
71 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
72 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
74 flats_y = open_gap/2 + th;
76 stride_z = hinge_unit*2 + hinge_z_gap*2;
77 total_z = hinge_units * stride_z - hinge_z_gap;
82 pin_flatten = pin_dia/2 * (1 - cos(45));
84 bolt_stride = total_z / nbolts;
90 vhook_theta = atan2( smooth_r, main_r );
92 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
93 vhook_ctr = vhook_y0 - vhook_inside/2;
94 vhook_outer_dia = vhook_inside + vhook_th*2;
98 cleat_horn_tl = cleat_horn_l + cleat_stem_l/2;
102 + cleat_horn_d_min[0]/2
103 - cleat_horn_d_min[0]/2 * cleat_overlap
107 // calculated - hhook
109 hhook_outer_dia = hhook_inside + hhook_th*2;
111 hhook_ctr = -max(main_r + hhook_inside/2,
112 tube_dia/2 + hhook_outer_dia/2);
118 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
121 module TubePlan(){ circle(r = tube_dia/2); }
122 module MainCirclePlan(){ circle(r = main_r); }
124 module PlanWeldMainCircle(){
135 rotate(-135) square(100);
139 module MainPlan(flatten=false) {
143 translate([hinge_x, 0]) circle(r= hinge_o_r);
145 rectfromto([0, -flats_y],
149 rectfromto([0, -open_gap/2],
150 [max_x+1, +open_gap/2]);
151 translate([hinge_x, 0]) {
153 circle(r= hole_dia/2);
155 translate([ pin_flatten, 0 ])
156 square(center=true, [hole_dia, hole_dia + 1]);
162 module Portion(d=0) {
163 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
164 rectfromto([hinge_x*2, 0],
165 [max_x+10, -(tube_dia/2+th+10)]);
168 module MainPlanA(flatten){
175 module MainPlanB(flatten){
182 module HalfClampXPositive(flatten=false){
183 translate([0,0, min_z]) {
184 linextr(0, total_z) mirror([0,1]) MainPlanB();
185 for (i=[0 : hinge_units-1]) {
186 translate([0,0, stride_z*i])
187 linextr(0, hinge_unit) MainPlanA(flatten);
192 module HalfClampXNegative(){
193 for (j=[0:nbolts-1]) {
194 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
195 translate([0, -tube_dia/2, 0])
197 cylinder(r= bolt_hole_r, h= tube_dia);
198 translate([0, -flats_y, 0])
200 cylinder(r= bolt_flat/2, h= tube_dia/2);
205 module HalfClampX(flatten=false){
207 HalfClampXPositive(flatten);
208 HalfClampXNegative();
212 // ---------- vhook ----------
214 module VHookProfile() {
215 translate([0, -vhook_inside/2 - vhook_th/2])
216 circle(r = vhook_th/2);
219 module VHookHookMain(outer=false){ ////toplevel
221 rotate_extrude(convexity=10)
226 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
231 module VHookA(){ ////toplevel
234 translate([0, vhook_ctr, 0]){
237 linextr(-0.1, vhook_outer_dia/2)
239 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
240 sphere(r= vhook_th/2);
245 VHookHookMain(outer=true);
246 linextr_y_xz(0, vhook_outer_dia/2) hull(){
248 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
254 translate([0,0, -vhook_outer_dia])
255 cube(center=true, vhook_outer_dia*2);
259 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
260 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
263 module VHookPlanDemo(){
265 translate([0, vhook_ctr, 5])
268 color("blue") VHookProfile();
272 // ---------- cleat ----------
274 function cleat_frame_theta(s) = s * cleat_horn_tl / cleat_curve_r * 360/TAU;
275 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
276 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
277 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
278 cleat_horn_d_max * (1-s) ) * 0.5;
280 module CleatFrameSphere(r) {
281 scale([1, r[1]/r[0], 1])
285 module CleatFrame(s) {
286 r = cleat_frame_r(s);
287 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
294 for (si=[0 : cleat_frames-2]) {
295 s0 = si / (cleat_frames-1);
296 s1 = (si+1) / (cleat_frames-1);
305 frames = cleat_frames/2;
306 se = cleat_stem_l/2 / cleat_horn_tl;
307 r = cleat_frame_r(se);
310 for (s = [-se, se]) {
311 for (z= [-(cleat_height + tube_dia/2),
313 translate([cleat_frame_x(s), 0, z])
314 linear_extrude(height=0.1)
315 scale([1, r[1]/r[0]])
324 translate([0,0, vcleat_dz]){
326 translate([0, -(main_r + cleat_height), 0]) {
327 rotate([0, -90, 90]) {
336 linextr(-cleat_stem_l, +cleat_stem_l)
337 circle(r = tube_dia/2 + 0.1);
340 translate([0,0, total_z * 0.5])
342 (main_r + cleat_stem_l)*4 * [1,1,0] +
347 module VCleatA(){ ////toplevel
352 // ---------- hhook ----------
354 module HHookHookPlan(){
355 translate([0, hhook_ctr]){
357 circle(r = hhook_outer_dia/2);
358 circle(r = hhook_inside/2);
359 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
360 [0, +hhook_outer_dia]);
362 translate([0, -(hhook_inside/2 + hhook_th/2)]){
364 for (x=[-0.1, hhook_l]) {
365 translate([x,0]) square(center=true, hhook_th);
372 module HHookA(){ ////toplevel
374 linextr(min_z, max_z) {
379 module HHookPlanDemo(){
384 // ---------- linear bracket ----------
386 module LinearBracketA(){ ////toplevel
392 // ---------- misc ----------
394 module PinSitu(){ ////toplevel
397 translate([0,0, -pin_head_th])
398 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
400 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
402 translate([0,0, total_z + pin_tail/2])
404 translate([0,0, -pin_dia])
405 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
406 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
407 cube([50,100, total_z*2]);
411 module Pin(){ ////toplevel
417 module GeneralB(){ ////toplevel
421 module DummyA(){ ////toplevel
425 module PlanDemo(){ ////toplevel
427 translate([0,0,-4]) color("red") Portion(1);
428 translate([0,0,-2]) color("grey") Portion(0);
430 translate([0, tube_dia*1.5]) {
435 translate([0, -tube_dia*1.5]) {
438 translate([tube_dia*4, 0]) {
441 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
444 module DemoA(){ DummyA(); }
446 module Demo(){ ////toplevel
447 color("red") rotate([180,0,0]) GeneralB();
448 color("blue") DemoA();
449 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
450 rotate([0,0,180]) PinSitu();
453 module DemoPair(){ ////toplevel
454 color("red") rotate([180,0,0]) DemoA();
455 color("blue") DemoA();
456 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
457 rotate([0,0,180]) PinSitu();