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