aboutsummaryrefslogtreecommitdiff
path: root/lib/connectors.scad
blob: 063bcaaae96ad24716c993261ca3ffdae21ee8af (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
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);
        }
    }
}