-
Notifications
You must be signed in to change notification settings - Fork 0
/
enclosure.kcl
188 lines (178 loc) · 5.34 KB
/
enclosure.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// Enclosure
// An enclosure body and sealing lid for storing items
length = 175
width = 125
height = 70
wallThickness = 3
holeDia = 4
// Model a box with base enclosure dimensions
sketch001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> angledLine([0, width], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) + 90,
length
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> lineTo([profileStartX(%), profileStartY(%)], %, $rectangleSegmentD001)
|> close(%)
extrude001 = extrude(height, sketch001)
|> fillet({
radius: wallThickness * 4,
tags: [
getNextAdjacentEdge(rectangleSegmentA001),
getNextAdjacentEdge(rectangleSegmentB001),
getNextAdjacentEdge(rectangleSegmentC001),
getNextAdjacentEdge(rectangleSegmentD001)
]
}, %)
// Apply a shell to the enclosure base to create the internal storage
|> shell({
faces: ["end"],
thickness: wallThickness
}, %)
// Define a function to create the internal structure to secure a fastener at each corner
fn function001 = (originStart) => {
// Create a plane to sketch on shell interior
plane001 = {
plane: {
origin: [0.0, 0.0, wallThickness],
xAxis: [1.0, 0.0, 0.0],
yAxis: [0.0, 1.0, 0.0],
zAxis: [0.0, 0.0, 1.0]
}
}
// Create a pillar with a fasterner hole at the center
sketch002 = startSketchOn(plane001)
|> circle({center: [originStart[0], originStart[1]], radius: holeDia + wallThickness}, %)
|> hole(circle({center: [originStart[0], originStart[1]], radius: holeDia}, %), %)
extrude002 = extrude(height - wallThickness, sketch002)
return extrude002
}
// Place the internal pillar at each corner
function001([
wallThickness * 3 + holeDia,
wallThickness * 3 + holeDia
])
function001([
wallThickness * 3 + holeDia,
length - (wallThickness * 3 + holeDia)
])
function001([
width - (wallThickness * 3 + holeDia),
wallThickness * 3 + holeDia
])
function001([
width - (wallThickness * 3 + holeDia),
length - (wallThickness * 3 + holeDia)
])
// Define lid position and outer surface
sketch003 = startSketchOn('XY')
|> startProfileAt([width * 1.2, 0], %)
|> angledLine([0, width], %, $rectangleSegmentA002)
|> angledLine([
segAng(rectangleSegmentA001) + 90,
length
], %, $rectangleSegmentB002)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC002)
|> lineTo([profileStartX(%), profileStartY(%)], %, $rectangleSegmentD002)
|> close(%)
|> hole(circle({
center: [
width * 1.2 + wallThickness * 3 + holeDia,
wallThickness * 3 + holeDia
],
radius: holeDia
}, %), %)
|> hole(circle({
center: [
width * 1.2 + wallThickness * 3 + holeDia,
length - (wallThickness * 3 + holeDia)
],
radius: holeDia
}, %), %)
|> hole(circle({
center: [
width * 2.2 - (wallThickness * 3 + holeDia),
wallThickness * 3 + holeDia
],
radius: holeDia
}, %), %)
|> hole(circle({
center: [
width * 2.2 - (wallThickness * 3 + holeDia),
length - (wallThickness * 3 + holeDia)
],
radius: holeDia
}, %), %)
extrude003 = extrude(wallThickness, sketch003)
|> fillet({
radius: wallThickness * 4,
tags: [
getNextAdjacentEdge(rectangleSegmentA002),
getNextAdjacentEdge(rectangleSegmentB002),
getNextAdjacentEdge(rectangleSegmentC002),
getNextAdjacentEdge(rectangleSegmentD002)
]
}, %)
// Define lid inner and sealing surfaces
sketch004 = startSketchOn(extrude003, 'END')
|> startProfileAt([
width * 1.2 + wallThickness,
wallThickness
], %)
|> angledLine([0, width - (2 * wallThickness)], %, $rectangleSegmentA003)
|> angledLine([
segAng(rectangleSegmentA003) + 90,
length - (2 * wallThickness)
], %, $rectangleSegmentB003)
|> angledLine([
segAng(rectangleSegmentA003),
-segLen(rectangleSegmentA003)
], %, $rectangleSegmentC003)
|> lineTo([profileStartX(%), profileStartY(%)], %, $rectangleSegmentD003)
|> close(%)
|> hole(circle({
center: [
width * 1.2 + wallThickness * 3 + holeDia,
wallThickness * 3 + holeDia
],
radius: holeDia + wallThickness
}, %), %)
|> hole(circle({
center: [
width * 1.2 + wallThickness * 3 + holeDia,
length - (wallThickness * 3 + holeDia)
],
radius: holeDia + wallThickness
}, %), %)
|> hole(circle({
center: [
width * 2.2 - (wallThickness * 3 + holeDia),
wallThickness * 3 + holeDia
],
radius: holeDia + wallThickness
}, %), %)
|> hole(circle({
center: [
width * 2.2 - (wallThickness * 3 + holeDia),
length - (wallThickness * 3 + holeDia)
],
radius: holeDia + wallThickness
}, %), %)
extrude004 = extrude(wallThickness, sketch004)
|> fillet({
radius: wallThickness * 3,
tags: [
getNextAdjacentEdge(rectangleSegmentA003),
getNextAdjacentEdge(rectangleSegmentB003),
getNextAdjacentEdge(rectangleSegmentC003),
getNextAdjacentEdge(rectangleSegmentD003)
]
}, %)