kcl-samplesmounting-plate

mounting-plate

mounting-plate

KCL

// 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])
       ],
     )