-
Notifications
You must be signed in to change notification settings - Fork 0
/
mounting-plate.kcl
71 lines (66 loc) · 2 KB
/
mounting-plate.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
// Mounting Plate
// A flat piece of material, often metal or plastic, that serves as a support or base for attaching, securing, or mounting various types of equipment, devices, or components.
// Define constants
plateLength = 10
plateWidth = 6
filletRadius = 0.5
plateThickness = .5
centerHoleDiameter = 2
// Create a function that defines the body width and length of the mounting plate. Tag the corners so they can be passed through the fillet function.
fn rectShape = (pos, w, l) => {
rr = startSketchOn('XY')
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %, $edge1)
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, $edge2)
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, $edge3)
|> close(%, $edge4)
return rr
}
// Define the hole radius and x, y location constants
holeRadius = .25
holeIndex = .75
// Create the mounting plate extrusion, holes, and fillets
rs = rectShape([0, 0], plateWidth, plateLength)
part = rs
|> hole(circle({
center: [
-plateWidth / 2 + holeIndex,
plateLength / 2 - holeIndex
],
radius: holeRadius
}, %), %)
|> hole(circle({
center: [
plateWidth / 2 - holeIndex,
plateLength / 2 - holeIndex
],
radius: holeRadius
}, %), %)
|> hole(circle({
center: [
-plateWidth / 2 + holeIndex,
-plateLength / 2 + holeIndex
],
radius: holeRadius
}, %), %)
|> hole(circle({
center: [
plateWidth / 2 - holeIndex,
-plateLength / 2 + holeIndex
],
radius: holeRadius
}, %), %)
|> hole(circle({
center: [0, 0],
radius: centerHoleDiameter
}, %), %)
|> extrude(plateThickness, %)
|> fillet({
radius: filletRadius,
tags: [
getPreviousAdjacentEdge(rs.tags.edge1),
getPreviousAdjacentEdge(rs.tags.edge2),
getPreviousAdjacentEdge(rs.tags.edge3),
getPreviousAdjacentEdge(rs.tags.edge4)
]
}, %)