Files
modeling-app/public/kcl-samples/mounting-plate/main.kcl
Kurt Hutten 33f7badf41 point and click-ify mounting plate (#7287)
* point and click-ify mounting plate

* Update kcl-samples simulation test output

* Update public/kcl-samples/mounting-plate/main.kcl

* Update public/kcl-samples/mounting-plate/main.kcl

* fix

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-03 08:10:37 -04:00

67 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
// Define the hole radius and x, y location constants
holeRadius = .25
holeIndex = .75
sketch001 = startSketchOn(XY)
rectShape = startProfile(sketch001, at = [-plateWidth / 2, plateLength / 2])
|> angledLine(angle = 0, length = plateWidth, tag = $basePlateEdge1)
|> angledLine(angle = segAng(basePlateEdge1) - 90, length = plateLength, tag = $basePlateEdge2)
|> angledLine(angle = segAng(basePlateEdge1), length = -segLen(basePlateEdge1), tag = $basePlateEdge3)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $basePlateEdge4)
|> close()
// Create the mounting plate extrusion, holes, and fillets
part = rectShape
|> 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 = [
getCommonEdge(faces = [basePlateEdge3, basePlateEdge2]),
getCommonEdge(faces = [basePlateEdge4, basePlateEdge3]),
getCommonEdge(faces = [basePlateEdge4, basePlateEdge1]),
getCommonEdge(faces = [basePlateEdge2, basePlateEdge1])
],
)