Files
modeling-app/public/kcl-samples/car-wheel-assembly/car-rotor.kcl
Nick Cameron 7d7b153085 Add START and END constants to std (#6270)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-04-14 20:37:45 +12:00

90 lines
3.3 KiB
Plaintext

// Wheel rotor
// A component of a disc brake system. It provides a surface for brake pads to press against, generating the friction needed to slow or stop the vehicle.
// Set units
@settings(defaultLengthUnit = in)
// Import parameters
import rotorDiameter, rotorInnerDiameter, rotorSinglePlateThickness, rotorInnerDiameterThickness, lugHolePatternDia, lugSpacing, rotorTotalThickness, spacerPatternDiameter, spacerDiameter, spacerLength, spacerCount, wheelDiameter, lugCount, yAxisOffset, drillAndSlotCount from "parameters.kcl"
rotorSketch = startSketchOn(XZ)
|> circle(center = [0, 0], radius = rotorDiameter / 2)
rotor = extrude(rotorSketch, length = rotorSinglePlateThickness)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
rotorBumpSketch = startSketchOn(rotor, END)
|> circle(center = [0, 0], radius = rotorInnerDiameter / 2)
rotorBump = extrude(rotorBumpSketch, length = rotorInnerDiameterThickness)
lugHoles = startSketchOn(rotorBump, END)
|> circle(center = [-lugSpacing / 2, 0], radius = 0.315)
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = lugCount,
rotateDuplicates = true,
)
|> extrude(%, length = -(rotorInnerDiameterThickness + rotorSinglePlateThickness))
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
// (update when boolean is available)
centerSpacer = startSketchOn(rotor, START)
|> circle(%, center = [0, 0], radius = .25)
|> extrude(%, length = spacerLength)
secondaryRotorSketch = startSketchOn(centerSpacer, END)
|> circle(center = [0, 0], radius = rotorDiameter / 2)
secondRotor = extrude(secondaryRotorSketch, length = rotorSinglePlateThickness)
lugHoles2 = startSketchOn(secondRotor, END)
|> circle(center = [-lugSpacing / 2, 0], radius = 0.315)
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = lugCount,
rotateDuplicates = true,
)
|> extrude(length = -rotorSinglePlateThickness)
spacerSketch = startSketchOn(rotor, START)
|> circle(center = [spacerPatternDiameter / 2, 0], radius = spacerDiameter)
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = spacerCount,
rotateDuplicates = true,
)
spacers = extrude(spacerSketch, length = spacerLength)
rotorSlottedSketch = startSketchOn(rotor, START)
|> startProfileAt([2.17, 2.56], %)
|> xLine(length = 0.12)
|> yLine(length = 2.56)
|> xLine(length = -0.12)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(
center = [0, 0],
instances = drillAndSlotCount,
arcDegrees = 360,
rotateDuplicates = true,
)
rotorSlotted = extrude(rotorSlottedSketch, length = -rotorSinglePlateThickness / 2)
secondRotorSlottedSketch = startSketchOn(secondRotor, END)
|> startProfileAt([-2.17, 2.56], %)
|> xLine(length = -0.12)
|> yLine(length = 2.56)
|> xLine(length = 0.12)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(
center = [0, 0],
instances = drillAndSlotCount,
arcDegrees = 360,
rotateDuplicates = true,
)
extrude(secondRotorSlottedSketch, length = -rotorSinglePlateThickness / 2)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)