chiark / gitweb /
scaffold-clamp: wip vhook
[reprap-play.git] / scaffold-clamp.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 tube_dia = 48.3;
6
7 th = 7;
8
9 pin_gap = 1.5; // around
10
11 smooth_r = 15;
12
13 bolt_dia = 5 + 0.75;
14 bolt_flat = 10 + 1;
15
16 open_gap = 10;
17
18 hinge_unit = 10;
19 hinge_units = 4;
20 hinge_z_gap = 1;
21
22 // calculated
23
24 pin_dia = th;
25 hole_dia = th + pin_gap;
26
27 hinge_gap = pin_gap;
28
29 hinge_o_r = 0.5 * hole_dia + th;
30
31 hinge_x = -0.5 * tube_dia - hinge_o_r;
32 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
33 max_x = bolt_x + max(0.5 + bolt_dia + th, 0.5 * bolt_flat/2);
34
35 flats_y = open_gap/2 + th;
36
37 stride_z = hinge_unit*2 + hinge_z_gap*2;
38 total_z = hinge_units * stride_z - hinge_z_gap;
39
40 min_z = -total_z/2;
41 max_z = +total_z/2;
42
43 pin_flatten = pin_dia/2 * (1 - cos(45));
44
45 $fa = 3;
46 $fs = 0.1;
47
48 module SmoothPlan(){
49   offset(r=-smooth_r) offset(delta=smooth_r) children(0);
50 }
51
52 module TubePlan(){ circle(r = tube_dia/2); }
53 module MainCirclePlan(){ circle(r = tube_dia/2 + th); }
54
55 module PlanWeldMainCircle(){
56   intersection(){
57     difference(){
58       SmoothPlan(){
59         union(){
60           MainCirclePlan();
61           children(0);
62         }
63       }
64       TubePlan();
65     }
66     rotate(-135) square(100);
67   }
68 }
69
70 module MainPlan(flatten=false) {
71   difference(){
72     SmoothPlan()
73       union(){
74       translate([hinge_x, 0]) circle(r= hinge_o_r);
75       MainCirclePlan();
76       rectfromto([0,           -flats_y],
77                  [max_x,       +flats_y]);
78     }
79     TubePlan();
80     rectfromto([0,       -open_gap/2],
81                [max_x+1, +open_gap/2]);
82     translate([hinge_x, 0]) {
83       intersection(){
84         circle(r= hole_dia/2);
85         if (flatten)
86           translate([ pin_flatten, 0 ])
87           square(center=true, [hole_dia, hole_dia + 1]);
88       }
89     }
90   }
91 }
92
93 module Portion(d=0) {
94   translate([hinge_x, 0]) circle(r= hinge_o_r + d);
95   rectfromto([hinge_x*2, 0],
96              [max_x+10, -(tube_dia/2+th+10)]);
97 }
98
99 module MainPlanA(flatten){
100   intersection(){
101     MainPlan(flatten);
102     Portion(0);
103   }
104 }
105
106 module MainPlanB(flatten){
107   difference(){
108     MainPlan(flatten);
109     Portion(hinge_gap);
110   }
111 }
112
113 module VHookPlan() {
114   PlanWeldMainCircle(){
115     rectfromto([ -5, 0 ],
116                [ +5, -60 ]);
117   }
118 }
119
120 module HalfClampX(flatten=false){
121   difference(){
122     translate([0,0, min_z]) {
123       linextr(0, total_z) mirror([0,1]) MainPlanB();
124       for (i=[0 : hinge_units-1]) {
125         translate([0,0, stride_z*i])
126           linextr(0, hinge_unit) MainPlanA(flatten);
127       }
128     }
129     for (dz=[-1,+1]) {
130       translate([ bolt_x, 0, dz * total_z/4 ]) {
131         translate([0, -tube_dia/2, 0])
132           rotate([-90,0,0])
133           cylinder(r= bolt_dia/2, h= tube_dia);
134         translate([0, -flats_y, 0])
135           rotate([90,0,0])
136           cylinder(r= bolt_flat/2, h= tube_dia/2);
137       }
138     }
139   }
140 }
141
142 module PlanDemo(){ ////toplevel
143   MainPlan();
144   translate([0,0,-4]) color("red") Portion(1);
145   translate([0,0,-2]) color("grey") Portion(0);
146
147   translate([0, tube_dia*1.5]) {
148     MainPlanB();
149     MainPlanA();
150   }
151
152   translate([0, -tube_dia*1.5]) {
153     VHookPlan();
154   }
155 //  translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
156 }
157
158 module GeneralB(){ ////toplevel
159   HalfClampX(true);
160 }
161
162 module DummyA(){ ////toplevel
163   HalfClampX();
164 }
165
166 module VHookA(){ ////toplevel
167   DummyA();
168   linextr(min_z, max_z)
169     VHookPlan();
170 }
171
172 module Demo(){ ////toplevel
173   color("red") rotate([180,0,0]) GeneralB();
174   color("blue") DummyA();
175 }
176
177 //PlanDemo();
178 //HalfClamp();