Files
modeling-app/public/kcl-samples/pipe-flange-assembly/91251a404-bolt.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

55 lines
1.6 KiB
Plaintext

// Socket Head Cap Screw
// screw for mating the flanges together in the pipe flange assembly
// Set units
@settings(defaultLengthUnit = in)
// Import parameters
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "parameters.kcl"
// Create a function to make a the bolt
export fn bolt() {
// Create the head of the cap screw
boltHead = startSketchOn(XZ)
|> circle(center = [0, 0], radius = boltHeadDiameter / 2, tag = $topEdge)
|> extrude(length = -boltHeadLength)
|> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)])
// Define the sketch of the hex pattern on the screw head and extrude into the head
hexPatternSketch = startSketchOn(boltHead, 'start')
|> startProfileAt([
boltHexDrive / 2,
boltHexFlatLength / 2
], %)
|> angledLine({
angle = 270,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 210,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 150,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 90,
length = boltHexFlatLength
}, %)
|> angledLine({
angle = 30,
length = boltHexFlatLength
}, %)
|> close()
|> extrude(length = -boltHeadLength * 0.75)
// create the body of the bolt
boltBody = startSketchOn(boltHead, 'end')
|> circle(center = [0, 0], radius = boltDiameter / 2, tag = $filletEdge)
|> extrude(length = boltLength)
|> appearance(color = "#4dd043", metalness = 90, roughness = 90)
return boltBody
}