Files
modeling-app/public/kcl-samples/pipe-flange-assembly/95479a127-hex-nut.kcl
Josh Gomez 656eb0abec Update all KCL-Samples to be more ME friendly (#6132)
* update all kcl-samples

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Update kcl-samples simulation test output

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-04-04 11:03:13 -07:00

50 lines
1.3 KiB
Plaintext

// Hex Nut
// Hex nut for the screws in the pipe flange assembly.
// Set units
@settings(defaultLengthUnit = in)
// Import parameters
import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "parameters.kcl"
// Create a function to make the hex nut. Must be a function since multiple hex nuts are used
export fn hexNut() {
// Create the base of the hex nut
hexNutBase = startSketchOn(XY)
|> startProfileAt([
hexNutFlatToFlat / 2,
hexNutFlatLength / 2
], %)
|> angledLine({
angle = 270,
length = hexNutFlatLength
}, %)
|> angledLine({
angle = 210,
length = hexNutFlatLength
}, %)
|> angledLine({
angle = 150,
length = hexNutFlatLength
}, %)
|> angledLine({
angle = 90,
length = hexNutFlatLength
}, %)
|> angledLine({
angle = 30,
length = hexNutFlatLength
}, %)
|> close()
|> extrude(length = hexNutThickness)
// Create the hole in the center of the hex nut
hexNut = startSketchOn(hexNutBase, 'end')
|> circle(center = [0, 0], radius = hexNutDiameter / 2)
|> extrude(%, length = -hexNutThickness)
|> appearance(%, color = "#4edfd5")
return hexNut
}