chiark / gitweb /
filamentspool: Move FilamentCup commitid to very outside, with new FilamentCupPositive
[reprap-play.git] / cable-splice-clamp.scad
1 // -*- C -*-
2
3 include <commitid.scad>
4
5 cable_maxdia = 12;
6 cable_mindia = 6;
7 strap_width = 4 + 0.5;
8 total_len = 70;
9
10 wallmin = 1.5;
11
12 strap_count = 2;
13
14 strap_wall_h = 1.5;
15 strap_wall_l = 2.0;
16
17 delta_ellipse = 0.45;
18
19 // calculated
20
21 delta_shift = 1 - delta_ellipse;
22
23 roundoff_rad = cable_maxdia/2 * sqrt(delta_shift)
24               + cable_mindia/2 * (1-sqrt(delta_shift));
25
26 outerdia = 2*(roundoff_rad / cos(30) + wallmin);
27
28 delta_shift_gap = (cable_maxdia-cable_mindia) * delta_shift;
29
30 writing_dx = outerdia * sin(30);
31 writing_dz = total_len / 3;
32
33 module CrossSection(plus=0) {
34   difference(){
35     for (dx = [-plus, 0, plus])
36       translate([dx, 0])
37       circle(r= outerdia/2, $fn=6);
38
39     intersection(){
40       scale([cable_maxdia,
41              cable_maxdia * delta_shift + cable_mindia * delta_ellipse])
42         circle(r= sqrt(0.5) * delta_shift + 0.5 * delta_ellipse, $fn=4);
43       circle(r= roundoff_rad, $fn=20);
44     }
45
46     square(center=true, [40, delta_shift_gap]);
47   }
48 }
49
50 module CrossSectionDemo(){ ////toplevel
51   color("blue"){
52     translate([0, delta_shift_gap/2, 0]){
53       difference(){
54         circle(r = cable_maxdia/2, $fn=20);
55         circle(r = cable_mindia/2, $fn=20);
56       }
57     }
58   }
59   
60   linear_extrude(height=20)
61     CrossSection(0);
62
63   color("red")
64     linear_extrude(height=1)
65     CrossSection(2);
66 }
67
68 module CompleteClamp(){ ////toplevel
69   difference(){
70     union(){
71       linear_extrude(height=total_len)
72         CrossSection();
73
74       for (i=[0 : strap_count]){
75         if (i*2 != strap_count) {
76           translate([0, 0,
77                      total_len * (i + 0.5) / (strap_count + 1)])
78             for (m=[0,1]){
79               mirror([0,0,m])
80                 translate([0,0, strap_width/2])
81                 linear_extrude(height=strap_wall_l)
82                 CrossSection(strap_wall_h);
83             }
84         }
85       }
86     }
87
88     for (my = [0,1]) {
89       mirror([0,my,0])
90         translate([-writing_dx/2,
91                    cos(30) * outerdia/2,
92                    (total_len - writing_dz)/2])
93         rotate([90,0,0])
94         Commitid_BestCount([writing_dx, writing_dz]);
95     }
96   }
97 }
98
99 module HalfPrint(){ ////toplevel
100   rotate([0,180,0]){
101     intersection(){
102       rotate([-90,0,-90])
103         CompleteClamp();
104       translate([-100,-100,0]) cube([1000,200,200]);
105     }
106   }
107 }
108
109 //CrossSectionDemo();
110 //CompleteClamp();
111 HalfPrint();