chiark / gitweb /
scaffold-clamp: wip
[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 pin_flatten = pin_dia/2 * (1 - cos(45));
41
42 $fa = 3;
43 $fs = 0.1;
44
45 module MainPlan(flatten=false) {
46   difference(){
47     offset(r=-smooth_r) offset(delta=smooth_r)
48       union(){
49       translate([hinge_x, 0]) circle(r= hinge_o_r);
50       circle(r = tube_dia/2 + th);
51       rectfromto([0,           -flats_y],
52                  [max_x,       +flats_y]);
53     }
54     circle(r = tube_dia/2);
55     rectfromto([0,       -open_gap/2],
56                [max_x+1, +open_gap/2]);
57     translate([hinge_x, 0]) {
58       intersection(){
59         circle(r= hole_dia/2);
60         if (flatten)
61           translate([ pin_flatten, 0 ])
62           square(center=true, [hole_dia, hole_dia + 1]);
63       }
64     }
65   }
66 }
67
68 module Portion(d=0) {
69   translate([hinge_x, 0]) circle(r= hinge_o_r + d);
70   rectfromto([hinge_x*2, 0],
71              [max_x+10, -(tube_dia/2+th+10)]);
72 }
73
74 module MainPlanA(flatten){
75   intersection(){
76     MainPlan(flatten);
77     Portion(0);
78   }
79 }
80
81 module MainPlanB(flatten){
82   difference(){
83     MainPlan(flatten);
84     Portion(hinge_gap);
85   }
86 }
87
88 module HalfClampX(flatten=false){
89   difference(){
90     translate([0,0, -total_z/2]) {
91       linextr(0, total_z) mirror([0,1]) MainPlanB();
92       for (i=[0 : hinge_units-1]) {
93         translate([0,0, stride_z*i])
94           linextr(0, hinge_unit) MainPlanA(flatten);
95       }
96     }
97     for (dz=[-1,+1]) {
98       translate([ bolt_x, 0, dz * total_z/4 ]) {
99         translate([0, -tube_dia/2, 0])
100           rotate([-90,0,0])
101           cylinder(r= bolt_dia/2, h= tube_dia);
102         translate([0, -flats_y, 0])
103           rotate([90,0,0])
104           cylinder(r= bolt_flat/2, h= tube_dia/2);
105       }
106     }
107   }
108 }
109
110 module HalfClampA() { HalfClampX(false); }
111 module HalfClampB() { rotate([180,0,0]) HalfClampX(true); }
112
113 module PlanDemo(){ ////toplevel
114   MainPlan();
115   translate([0,0,-4]) color("red") Portion(1);
116   translate([0,0,-2]) color("grey") Portion(0);
117
118   translate([0, tube_dia*1.5]) {
119     MainPlanB();
120     MainPlanA();
121   }
122 //  translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
123 }
124
125 module GeneralB(){ ////toplevel
126   HalfClampX(true);
127 }
128
129 module DummyB(){ ////toplevel
130   HalfClampX();
131 }
132
133 module Demo(){ ////toplevel
134   color("red") HalfClampA();
135   color("blue") HalfClampB();
136 }
137
138 //PlanDemo();
139 //HalfClamp();