-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.kcl
90 lines (76 loc) · 2.12 KB
/
main.kcl
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
// Hollow Dodecahedron
// A regular dodecahedron or pentagonal dodecahedron is a dodecahedron composed of regular pentagonal faces, three meeting at each vertex. This example shows constructing the individual faces of the dodecahedron and extruding inwards.
// Set units
@settings(defaultLengthUnit = in)
// Input parameters
// circumscribed radius
circR = 25
// Calculated parameters
// thickness of the dodecahedron
wallThickness = circR * 0.2
// angle between faces in radians
dihedral = acos(-(sqrt(5) / 5))
// inscribed radius
inscR = circR / 15 * sqrt(75 + 30 * sqrt(5))
// pentagon edge length
edgeL = 4 * circR / (sqrt(3) * (1 + sqrt(5)))
// pentagon radius
pentR = edgeL / 2 / sin(toRadians(36))
// Define a plane for the bottom angled face
plane = {
plane = {
origin = [
-inscR * cos(toRadians(toDegrees(dihedral) - 90)),
0,
inscR - (inscR * sin(toRadians(toDegrees(dihedral) - 90)))
],
xAxis = [cos(dihedral), 0.0, sin(dihedral)],
yAxis = [0, 1, 0],
zAxis = [sin(dihedral), 0, -cos(dihedral)]
}
}
// Create a regular pentagon inscribed in a circle of radius pentR
bottomFace = startSketchOn('XY')
|> polygon({
radius = pentR,
numSides = 5,
center = [0, 0],
inscribed = true
}, %)
bottomSideFace = startSketchOn(plane)
|> polygon({
radius = pentR,
numSides = 5,
center = [0, 0],
inscribed = true
}, %)
// Extrude the faces in each plane
bottom = extrude(bottomFace, length = wallThickness)
bottomSide = extrude(bottomSideFace, length = wallThickness)
// Pattern the sides so we have a full dodecahedron
bottomBowl = patternCircular3d(
bottomSide,
instances = 5,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = true
)
// pattern the bottom to create the top face
patternCircular3d(
bottom,
instances = 2,
axis = [0, 1, 0],
center = [0, 0, inscR],
arcDegrees = 360,
rotateDuplicates = true
)
// pattern the bottom angled faces to create the top
patternCircular3d(
bottomBowl,
instances = 2,
axis = [0, 1, 0],
center = [0, 0, inscR],
arcDegrees = 360,
rotateDuplicates = true
)