Files
modeling-app/public/kcl-samples/ball-bearing/main.kcl
Josh Gomez 58e0c0e916 Improve KCL Samples (#5767)
* improve KCL Samples & .gitignore

* update block and car wheel assembly

* update flange and lego, delete flange xy

* artifacts

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>

* scale

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

* updates

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

* docs

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>

* updates

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

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
2025-03-13 23:38:51 -07:00

112 lines
3.0 KiB
Plaintext

// Ball Bearing
// A ball bearing is a type of rolling-element bearing that uses balls to maintain the separation between the bearing races. The primary purpose of a ball bearing is to reduce rotational friction and support radial and axial loads.
// Set units
@settings(defaultLengthUnit = in)
// Define constants like ball diameter, inside diamter, overhange length, and thickness
outsideDiameter = 1.625
sphereDia = 0.25
shaftDia = 0.75
overallThickness = 0.313
wallThickness = 0.100
overHangLength = .3
nBalls = 10
chainWidth = sphereDia / 2
chainThickness = sphereDia / 8
linkDiameter = sphereDia / 4
// Sketch the inside bearing piece
insideWallSketch = startSketchOn(offsetPlane("XY", offset = -overallThickness / 2))
|> circle(
center = [0, 0],
radius = shaftDia / 2 + wallThickness
)
|> hole(circle(
center = [0, 0],
radius = shaftDia / 2
), %)
// Extrude the inside bearing piece
insideWall = extrude(insideWallSketch, length = overallThickness)
// Create the sketch of one of the balls
ballsSketch = startSketchOn("XY")
|> startProfileAt([shaftDia / 2 + wallThickness, 0.001], %)
|> arc({
angleEnd = 0,
angleStart = 180,
radius = sphereDia / 2
}, %)
|> close()
// Revolve the ball to make a sphere and pattern around the inside wall
balls = revolve({ axis = "X" }, ballsSketch)
|> patternCircular3d(
arcDegrees = 360,
axis = [0, 0, 1],
center = [0, 0, 0],
instances = nBalls,
rotateDuplicates = true
)
// Create the sketch for the chain around the balls
chainSketch = startSketchOn("XY")
|> startProfileAt([
shaftDia / 2 + wallThickness + sphereDia / 2 - (chainWidth / 2),
0.125 * sin(toRadians(60))
], %)
|> arc({
angleEnd = 60,
angleStart = 120,
radius = sphereDia / 2
}, %)
|> line(end = [0, chainThickness])
|> line(end = [-chainWidth, 0])
|> close()
// Revolve the chain sketch
chainHead = revolve({ axis = "X" }, chainSketch)
|> patternCircular3d(
arcDegrees = 360,
axis = [0, 0, 1],
center = [0, 0, 0],
instances = nBalls,
rotateDuplicates = true
)
// Create the sketch for the links in between the chains
linkSketch = startSketchOn("XZ")
|> circle(
center = [
shaftDia / 2 + wallThickness + sphereDia / 2,
0
],
radius = linkDiameter / 2
)
// Revolve the link sketch
linkRevolve = revolve({ axis = 'Y', angle = 360 / nBalls }, linkSketch)
|> patternCircular3d(
arcDegrees = 360,
axis = [0, 0, 1],
center = [0, 0, 0],
instances = nBalls,
rotateDuplicates = true
)
// Create the sketch for the outside walls
outsideWallSketch = startSketchOn(offsetPlane("XY", offset = -overallThickness / 2))
|> circle(
center = [0, 0],
radius = outsideDiameter / 2
)
|> hole(circle(
center = [0, 0],
radius = shaftDia / 2 + wallThickness + sphereDia
), %)
outsideWall = extrude(outsideWallSketch, length = overallThickness)
// https://www.mcmaster.com/60355K185/