71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
// 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.
|
|
|
|
// Set units
|
|
@settings(defaultLengthUnit = in, kclVersion = 1.0)
|
|
|
|
// Define parameters
|
|
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)
|
|
|> startProfile(at = [pos[0] - (w / 2), pos[1] - (l / 2)])
|
|
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
|
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
|
|> line(endAbsolute = [pos[0] - (w / 2), pos[1] + l / 2], tag = $edge3)
|
|
|> close(tag = $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(pos = [0, 0], w = plateWidth, l = plateLength)
|
|
part = rs
|
|
|> subtract2d(tool = circle(
|
|
center = [
|
|
-plateWidth / 2 + holeIndex,
|
|
plateLength / 2 - holeIndex
|
|
],
|
|
radius = holeRadius,
|
|
))
|
|
|> subtract2d(tool = circle(
|
|
center = [
|
|
plateWidth / 2 - holeIndex,
|
|
plateLength / 2 - holeIndex
|
|
],
|
|
radius = holeRadius,
|
|
))
|
|
|> subtract2d(tool = circle(
|
|
center = [
|
|
-plateWidth / 2 + holeIndex,
|
|
-plateLength / 2 + holeIndex
|
|
],
|
|
radius = holeRadius,
|
|
))
|
|
|> subtract2d(tool = circle(
|
|
center = [
|
|
plateWidth / 2 - holeIndex,
|
|
-plateLength / 2 + holeIndex
|
|
],
|
|
radius = holeRadius,
|
|
))
|
|
|> subtract2d(tool = circle(center = [0, 0], radius = centerHoleDiameter))
|
|
|> extrude(length = plateThickness)
|
|
|> fillet(
|
|
radius = filletRadius,
|
|
tags = [
|
|
getPreviousAdjacentEdge(rs.tags.edge1),
|
|
getPreviousAdjacentEdge(rs.tags.edge2),
|
|
getPreviousAdjacentEdge(rs.tags.edge3),
|
|
getPreviousAdjacentEdge(rs.tags.edge4)
|
|
],
|
|
)
|