9 pin_gap = 1.5; // around
24 hole_dia = th + pin_gap;
26 main_r = tube_dia/2 + th;
30 hinge_o_r = 0.5 * hole_dia + th;
32 hinge_x = -0.5 * tube_dia - hinge_o_r;
33 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
34 max_x = bolt_x + max(0.5 + bolt_dia + th, 0.5 * bolt_flat/2);
36 flats_y = open_gap/2 + th;
38 stride_z = hinge_unit*2 + hinge_z_gap*2;
39 total_z = hinge_units * stride_z - hinge_z_gap;
44 pin_flatten = pin_dia/2 * (1 - cos(45));
50 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
53 module TubePlan(){ circle(r = tube_dia/2); }
54 module MainCirclePlan(){ circle(r = main_r); }
56 module PlanWeldMainCircle(){
67 rotate(-135) square(100);
71 module MainPlan(flatten=false) {
75 translate([hinge_x, 0]) circle(r= hinge_o_r);
77 rectfromto([0, -flats_y],
81 rectfromto([0, -open_gap/2],
82 [max_x+1, +open_gap/2]);
83 translate([hinge_x, 0]) {
85 circle(r= hole_dia/2);
87 translate([ pin_flatten, 0 ])
88 square(center=true, [hole_dia, hole_dia + 1]);
95 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
96 rectfromto([hinge_x*2, 0],
97 [max_x+10, -(tube_dia/2+th+10)]);
100 module MainPlanA(flatten){
107 module MainPlanB(flatten){
114 module HalfClampX(flatten=false){
116 translate([0,0, min_z]) {
117 linextr(0, total_z) mirror([0,1]) MainPlanB();
118 for (i=[0 : hinge_units-1]) {
119 translate([0,0, stride_z*i])
120 linextr(0, hinge_unit) MainPlanA(flatten);
124 translate([ bolt_x, 0, dz * total_z/4 ]) {
125 translate([0, -tube_dia/2, 0])
127 cylinder(r= bolt_dia/2, h= tube_dia);
128 translate([0, -flats_y, 0])
130 cylinder(r= bolt_flat/2, h= tube_dia/2);
136 module GeneralPlanDemo(){ ////toplevel
138 translate([0,0,-4]) color("red") Portion(1);
139 translate([0,0,-2]) color("grey") Portion(0);
141 translate([0, tube_dia*1.5]) {
145 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
148 module GeneralB(){ ////toplevel
152 module DummyA(){ ////toplevel
156 module Demo(){ ////toplevel
157 color("red") rotate([180,0,0]) GeneralB();
158 color("blue") DummyA();