9 pin_gap = 1.5; // around
25 bolt_gap = 1.0; // total, on both sides
27 // ---------- vhook ----------
31 // ---------- cleat ----------
37 cleat_horn_d_max = 10;
39 // ---------- hhook ----------
45 // ========== defaults ==========
49 pin_hole_dia = pin_dia/2;
50 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
52 // ========== calculated ==========
56 hole_dia = th + pin_gap;
58 bolt_hole_r = (bolt_dia + bolt_gap)/2;
60 main_r = tube_dia/2 + th;
64 hinge_o_r = 0.5 * hole_dia + th;
66 hinge_x = -0.5 * tube_dia - hinge_o_r;
67 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
68 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
70 flats_y = open_gap/2 + th;
72 stride_z = hinge_unit*2 + hinge_z_gap*2;
73 total_z = hinge_units * stride_z - hinge_z_gap;
78 pin_flatten = pin_dia/2 * (1 - cos(45));
80 bolt_stride = total_z / nbolts;
86 vhook_theta = atan2( smooth_r, main_r );
88 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
89 vhook_ctr = vhook_y0 - vhook_inside/2;
90 vhook_outer_dia = vhook_inside + vhook_th*2;
94 hhook_outer_dia = hhook_inside + hhook_th*2;
96 hhook_ctr = -max(main_r + hhook_inside/2,
97 tube_dia/2 + hhook_outer_dia/2);
103 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
106 module TubePlan(){ circle(r = tube_dia/2); }
107 module MainCirclePlan(){ circle(r = main_r); }
109 module PlanWeldMainCircle(){
120 rotate(-135) square(100);
124 module MainPlan(flatten=false) {
128 translate([hinge_x, 0]) circle(r= hinge_o_r);
130 rectfromto([0, -flats_y],
134 rectfromto([0, -open_gap/2],
135 [max_x+1, +open_gap/2]);
136 translate([hinge_x, 0]) {
138 circle(r= hole_dia/2);
140 translate([ pin_flatten, 0 ])
141 square(center=true, [hole_dia, hole_dia + 1]);
147 module Portion(d=0) {
148 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
149 rectfromto([hinge_x*2, 0],
150 [max_x+10, -(tube_dia/2+th+10)]);
153 module MainPlanA(flatten){
160 module MainPlanB(flatten){
167 module HalfClampX(flatten=false){
169 translate([0,0, min_z]) {
170 linextr(0, total_z) mirror([0,1]) MainPlanB();
171 for (i=[0 : hinge_units-1]) {
172 translate([0,0, stride_z*i])
173 linextr(0, hinge_unit) MainPlanA(flatten);
176 for (j=[0:nbolts-1]) {
177 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
178 translate([0, -tube_dia/2, 0])
180 cylinder(r= bolt_hole_r, h= tube_dia);
181 translate([0, -flats_y, 0])
183 cylinder(r= bolt_flat/2, h= tube_dia/2);
189 // ---------- vhook ----------
191 module VHookProfile() {
192 translate([0, -vhook_inside/2 - vhook_th/2])
193 circle(r = vhook_th/2);
196 module VHookHookMain(outer=false){ ////toplevel
198 rotate_extrude(convexity=10)
203 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
208 module VHookA(){ ////toplevel
211 translate([0, vhook_ctr, 0]){
214 linextr(-0.1, vhook_outer_dia/2)
216 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
217 sphere(r= vhook_th/2);
222 VHookHookMain(outer=true);
223 linextr_y_xz(0, vhook_outer_dia/2) hull(){
225 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
231 translate([0,0, -vhook_outer_dia])
232 cube(center=true, vhook_outer_dia*2);
236 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
237 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
240 module VHookPlanDemo(){
242 translate([0, vhook_ctr, 5])
245 color("blue") VHookProfile();
249 // ---------- cleat ----------
251 module CleatFrame(s) {
252 translate([0,0, cleat_curve_r])
253 rotate( s * cleat_horn_l / cleat_curve_r * 360/TAU * [0,1,0] )
254 translate([0,0, -cleat_curve_r])
256 sphere(r= ( cleat_horn_d_min * s +
257 cleat_horn_d_max * (1-s) ) * 0.5);
262 for (si=[0 : cleat_frames-2]) {
263 s0 = si / (cleat_frames-1);
264 s1 = (si+1) / (cleat_frames-1);
272 module VCleatA(){ ////toplevel
278 // ---------- hhook ----------
280 module HHookHookPlan(){
281 translate([0, hhook_ctr]){
283 circle(r = hhook_outer_dia/2);
284 circle(r = hhook_inside/2);
285 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
286 [0, +hhook_outer_dia]);
288 translate([0, -(hhook_inside/2 + hhook_th/2)]){
290 for (x=[-0.1, hhook_l]) {
291 translate([x,0]) square(center=true, hhook_th);
298 module HHookA(){ ////toplevel
300 linextr(min_z, max_z) {
305 module HHookPlanDemo(){
310 // ---------- misc ----------
312 module PinSitu(){ ////toplevel
315 translate([0,0, -pin_head_th])
316 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
318 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
320 translate([0,0, total_z + pin_tail/2])
322 translate([0,0, -pin_dia])
323 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
324 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
325 cube([50,100, total_z*2]);
329 module Pin(){ ////toplevel
335 module GeneralB(){ ////toplevel
339 module DummyA(){ ////toplevel
343 module PlanDemo(){ ////toplevel
345 translate([0,0,-4]) color("red") Portion(1);
346 translate([0,0,-2]) color("grey") Portion(0);
348 translate([0, tube_dia*1.5]) {
353 translate([0, -tube_dia*1.5]) {
356 translate([tube_dia*4, 0]) {
359 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
362 module DemoA(){ DummyA(); }
364 module Demo(){ ////toplevel
365 color("red") rotate([180,0,0]) GeneralB();
366 color("blue") DemoA();
367 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
368 rotate([0,0,180]) PinSitu();