-
Notifications
You must be signed in to change notification settings - Fork 0
/
gate-hanger.scad
96 lines (87 loc) · 2.44 KB
/
gate-hanger.scad
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
post_diameter = 15; //mm
trough_height = 20; //mm
trough_length = 45; //mm
shim = 24; //mm
thickness = 2; // mm
plate_height = 45; //mm
radius = 2; //mm
hole_diameter = 3; //mm
horiz_angle = 0; //degrees
vert_angle = 0; //degrees
width = post_diameter + 4 * thickness;
$fn = 64;
hanger(width, plate_height, radius, thickness,
post_diameter, trough_height, trough_length,
horiz_angle, vert_angle );
module hanger(width, plate_height, radius, thickness,
post_diameter, trough_height, trough_length,
horiz_angle, vert_angle) {
union() {
plate(width, plate_height, radius, thickness);
trough(
post_diameter,
trough_height,
trough_length,
thickness,
horiz_angle,
vert_angle);
}
}
module plate(w, h, radius, t) {
linear_extrude(t, center=true) {
difference() {
minkowski() {
square([w - 2 * radius, h - 2 * radius], center=true);
circle(r=radius);
}
translate([w / 2 - 1.5 * hole_diameter, h / -2 + 1.5 * hole_diameter]) {
circle(d=hole_diameter);
}
translate([w / -2 + 1.5 * hole_diameter, h / -2 + 1.5 * hole_diameter]) {
circle(d=hole_diameter);
}
translate([0, h / 2 - 1.5 * hole_diameter]) {
circle(d=hole_diameter);
}
}
}
}
module trough(iw, ih, l, thickness, h_angle, v_angle) {
difference() {
rotate([v_angle, h_angle, 0]) {
union() {
linear_extrude(2 * l, center=true) {
difference() {
union() {
circle(d=iw + 2 * thickness);
translate([0, (ih - iw / 2) / 2]) {
square([iw + 2 * thickness, ih - iw / 2], center=true);
}
}
union() {
circle(d=iw);
translate([0, ih / 2]) {
square([iw, ih], center=true);
}
}
}
}
// insert shim
linear_extrude(2 * shim, center=true) {
difference() {
union() {
circle(d=iw + 2 * thickness);
translate([0, (ih - iw / 2) / 2]) {
square([iw + 2 * thickness, ih - iw / 2], center=true);
}
}
}
}
}
}
// cut off the bottom half
translate([0, 0, -l/2 - thickness]) {
cube([iw + ih + l, iw + ih + l, l + 2 * thickness], center=true);
}
}
}