Files
modeling-app/public/kcl-samples/walkie-talkie/button.kcl
2025-05-06 08:44:03 +12:00

33 lines
910 B
Plaintext

// Walkie Talkie Button
// Button for the walkie talkie
// Set units
@settings(defaultLengthUnit = in, kclVersion = 1.0)
// Import parameters
import buttonWidth, buttonHeight, buttonThickness from "parameters.kcl"
// Create a function for the button. We need to create a function to use multiple buttons.
export fn button() {
// Sketch the button profile and extrude
buttonSketch = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> angledLine(angle = 180, length = buttonWidth, tag = $tag1)
|> angledLine(angle = 270, length = buttonHeight, tag = $tag2)
|> angledLine(angle = 0, length = buttonWidth)
|> close()
button = extrude(buttonSketch, length = buttonThickness)
|> chamfer(
length = .050,
tags = [
getNextAdjacentEdge(tag1),
getNextAdjacentEdge(tag2)
],
)
|> appearance(color = "#ff0000")
return button
}