forked from jazwa/rackstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdovetail.scad
61 lines (49 loc) · 1.42 KB
/
dovetail.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
include <./math.scad>
// centered on z axis
module dovetail(
topWidth,
bottomWidth,
height,
length,
headExtension=0,
baseExtension=0,
frontFaceLength = 0,
frontFaceScale = 0,
backFaceLength = 0,
backFaceScale = 0,
) {
translate(v=[0,0,frontFaceLength])
linear_extrude(length-(frontFaceLength+backFaceLength))
dovetailFace(topWidth,bottomWidth,height,headExtension,baseExtension);
translate(v=[0,0,frontFaceLength])
mirror(v=[0,0,1])
linear_extrude(frontFaceLength, scale=[frontFaceScale, frontFaceScale])
dovetailFace(topWidth,bottomWidth,height,headExtension,baseExtension);
translate(v=[0,0,length-backFaceLength])
linear_extrude(backFaceLength, scale=[backFaceScale,1])
dovetailFace(topWidth,bottomWidth,height,headExtension,baseExtension);
module dovetailFace(topWidth, bottomWidth, height, headExtension, baseExtension) {
union() {
// base
polygon(points =
[[-bottomWidth/2, 0],
[-topWidth/2, height],
[topWidth/2, height],
[bottomWidth/2, 0]]
);
polygon(points =
[[-bottomWidth/2, -baseExtension],
[-bottomWidth/2,0 ],
[bottomWidth/2, 0],
[bottomWidth/2, -baseExtension]]
);
translate(v=[0,height])
polygon(points =
[[-topWidth/2, headExtension],
[-topWidth/2,0 ],
[topWidth/2, 0],
[topWidth/2, headExtension]]
);
}
}
}