aboutsummaryrefslogtreecommitdiff
path: root/lib/connectors.scad
blob: 078844e9bb7af6bef3c45adc0ac37c8413d0ba26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
module foot(radius,wall,len,foot_radius,foot_height,angle,hole_radius,hole_dist,end=true,hole=true,circlet=true) {

    cut_h = (radius+wall)*sin(angle);
    cut_r = (radius+wall)/cos(angle);

    difference() {
        union() {
            difference() {
                rotate([0,angle,0]) cylinder(r=radius + wall, h = len);
                translate([0,0,-cut_h]) cylinder(r=cut_r, h=cut_h);
            }
            translate([0,0,-0.01]) cylinder(r = foot_radius, h = foot_height);
            if (circlet) {
                translate([-(wall+radius),0,foot_height+2]) rotate([90, 0, 0]) difference() {
                    cylinder(r=8, h=4, center=true);
                    cylinder(r=4, h=5, center=true);
                }
            }
            if (end) {
                translate([cut_r,0,radius+wall]) rotate([0,90,0]) 
                    cylinder(r=radius + wall, h = len);
            }
        }
        if (circlet) {
            rotate([0, angle, 0]) translate([0,0, radius * sin(angle) + foot_height]) cylinder(r = radius, h = len);
        }
        if (hole) {
            translate([0,foot_radius - hole_dist,-1]) cylinder(r=hole_radius, h=foot_height + 2);
            translate([0,-foot_radius + hole_dist,-1]) cylinder(r=hole_radius, h=foot_height + 2);
        }
        if (end) {
            translate([cut_r+wall/2,0,radius+wall]) rotate([0,90,0]) 
                translate([0,0,wall]) cylinder(r=radius, h=len);
        }
    }
}

module t_connector(radius, wall, len, angle) {
    rotate([90,0,0]) difference() {
        union() {
            cylinder(r=radius + wall, h=len*2, center=true);
            rotate([0, angle, 0]) cylinder(r=radius + wall, h=len);
        }
        translate([0,0,len/2+wall/2]) cylinder(r=radius, h=len, center=true);
        translate([0,0,-len/2-wall/2]) cylinder(r=radius, h=len, center=true);
        rotate([0, angle, 0]) translate([0, 0, radius+wall]) cylinder(r=radius, h=len);
    }
}

module star_connector(radius, wall, len, angles) {
    rotate([90,0,0]) difference() {
        union() {
            sphere(r=radius + wall);
            for (a = angles) {
                rotate([0, a, 0]) cylinder(r=radius + wall, h=len);
            }
        }
        for (a = angles) {
            rotate([0, a, 0]) translate([0, 0, radius+wall]) cylinder(r=radius, h=len);
        }
    }
}

module cross_connector(radius, wall, len, angle) {
    cc_cylinder_len = len + (radius+wall)*tan(angle)*2;
    intersection() {
        difference() {
            union() {
                translate([0, radius, 0]) rotate([0, angle, 0])
                    cylinder(r=radius + wall, h=cc_cylinder_len, center=true);
                translate([0, -radius, 0]) rotate([0, -angle, 0])
                    cylinder(r=radius + wall, h=cc_cylinder_len, center=true);
            }
            translate([0, radius + 0.2, 0]) rotate([0, angle, 0])
                cylinder(r=radius, h=cc_cylinder_len+2, center=true);
            translate([0, -radius + 0.2, 0]) rotate([0, -angle, 0])
                cylinder(r=radius, h=cc_cylinder_len+2, center=true);
        }
        cube([(len+radius)*2, (len+radius)*2, len*sin(90-angle)], center=true);
    }
}