chiark / gitweb /
maglite-holder: Bracket as toplevel
[reprap-play.git] / cable-splice-clamp.scad
1 // -*- C -*-
2
3 include <commitid.scad>
4
5 rnom = 3.5 / 2;
6
7 // alpha is slope angle, which is half of inner concave angle that
8 //  wire sits in
9 alpha = 40; // degrees
10
11 // mu is minimum number of cable radii that cable tangent point (line)
12 //  with splint ought to be away from edge of split
13 mu = 1/4;
14
15 // wall thickness, and base width as fraction of cable size
16 wall_r = 2.5 / 6.5;
17 base_r = 0.75;
18
19 total_len = 60;
20
21 strap_width = 3.0 + 0.5;
22
23 strap_count = 4;
24
25 // for cross-section calculations:
26 //
27 // origin O is at intersection of straight line segments forming walls
28 // C is centre of circle (wire x-section) (of radius r or radius 1)
29 //       which is tangent to lines
30 // T is said tangent points
31 // B is inner base point, which is extension of line from B by mu*r
32
33 sina = sin(alpha);
34 cosa = cos(alpha);
35 tana = sina/cosa;
36
37 // blah_r is blah where r=1
38 // d_AB is distance AB
39 // dy_AB is " " " vertical component
40
41 d_OT_r = tana;
42 d_OB_r = tana + mu;
43
44 d_OC_r = 1/cosa;
45
46 dy_OB_r = d_OB_r * sina;
47
48 // *0 and *1 relate to smallest and largest wire
49 // r[01] is radius
50 // r10 is radius ratio
51
52 r10 = d_OC_r / dy_OB_r;
53
54 r0 = rnom / sqrt(r10);
55 r1 = rnom * sqrt(r10);
56
57 x_B_r =   d_OB_r * cosa;
58 y_B_r = -dy_OB_r;
59
60 x_T_r =         sina;
61 y_T_r = -tana * sina;
62
63 wall_x_r = wall_r / tan(90-alpha);
64
65 top = wall_r * r1 - (d_OC_r - 1) * r0;
66 basew = base_r * rnom;
67
68 echo("dias", r0*2, r1*2, "ratio",r1/r0);
69
70 module CrossSectionHalf(plus=0) {
71   difference(){
72     polygon([[-0.1,                                y_T_r * r0],
73              [x_T_r * r0,                          y_T_r * r0],
74              [x_B_r * r1,                          y_B_r * r1],
75              [x_B_r * r1 + wall_x_r * rnom + plus, y_B_r * r1],
76              [basew                        + plus, top],
77              [-0.1,                                top]]);
78     translate([0, -d_OC_r * r0])
79       circle(r = r0);
80   }
81 }
82
83 module CrossSection(plus=0) {
84   for (m=[0,1]) {
85     mirror([m,0])
86       CrossSectionHalf(plus);
87   }
88 }
89
90 module CrossSectionDemo(){ ////toplevel
91   color("black") CrossSection(2);
92   CrossSection();
93   for (rc=[["red", r1],
94            ["blue",r0]]) {
95     color(rc[0]) translate([0, -d_OC_r * rc[1]]) circle(r = rc[1]);
96   }
97 }
98
99 strap_wall_h = 1.5;
100 strap_wall_l = 2.0;
101
102 writing_dx = total_len / 3;
103 writing_dy = basew*2;
104
105 module HalfClamp(){ ////toplevel
106   difference(){
107     rotate([90,0,0])rotate([0,90,0]){
108       linear_extrude(height=total_len)
109         CrossSection();
110
111       for (i=[0 : strap_count]){
112         if (i*2 != strap_count) {
113           translate([0, 0,
114                      total_len * (i + 0.5) / (strap_count + 1)])
115             for (m=[0,1]){
116               mirror([0,0,m])
117                 translate([0,0, strap_width/2])
118                 linear_extrude(height=strap_wall_l)
119                 CrossSection(strap_wall_h);
120             }
121         }
122       }
123     }
124
125     translate([0, -basew, top])
126       Commitid_BestCount([writing_dx, writing_dy]);
127   }
128 }
129
130 module HalfClampPrint(){ ////toplevel
131   rotate([180,0,0])
132     HalfClamp();
133 }
134
135 //CrossSection();
136 //CrossSectionDemo();
137 //HalfClamp();
138 HalfClampPrint();