Skip to content

Commit 81dc549

Browse files
Update KCL docs (#561)
YOYO NEW KCL DOCS!! Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 57e5fc8 commit 81dc549

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

content/pages/docs/kcl-samples/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ When you submit a PR to add or modify KCL samples, images will be generated and
2727
[![axial-fan](screenshots/axial-fan.png)](axial-fan/main.kcl)
2828
#### [ball-bearing](ball-bearing/main.kcl) ([screenshot](screenshots/ball-bearing.png))
2929
[![ball-bearing](screenshots/ball-bearing.png)](ball-bearing/main.kcl)
30+
#### [ball-joint-rod-end](ball-joint-rod-end/main.kcl) ([screenshot](screenshots/ball-joint-rod-end.png))
31+
[![ball-joint-rod-end](screenshots/ball-joint-rod-end.png)](ball-joint-rod-end/main.kcl)
3032
#### [bench](bench/main.kcl) ([screenshot](screenshots/bench.png))
3133
[![bench](screenshots/bench.png)](bench/main.kcl)
3234
#### [bone-plate](bone-plate/main.kcl) ([screenshot](screenshots/bone-plate.png))
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// ball joint rod end
2+
// A ball joint rod end is a mechanical linkage component that consists of a spherical ball housed within a socket, connected to a threaded rod, allowing rotational movement in multiple directions while providing a secure connection point between two parts of a mechanical system. Commonly used in steering systems and suspension components.
3+
4+
// Set Units
5+
@settings(defaultLengthUnit = in, kclVersion = 1.0)
6+
7+
// variables
8+
ballBoltLength = 6
9+
ballRadius = 8
10+
sketchStartAngle = asin(ballBoltLength / ballRadius)
11+
housingThicknessHalf = 4.5
12+
housingR1 = 11
13+
housingR2 = 8
14+
tolerance = 0.1
15+
shaftR = 8
16+
distanceBetweenEyeAndShaftEnd = 36
17+
radiusToFlat = 12
18+
flatsWidth = 14
19+
tapperInAng = 45
20+
holeDForM8Tap = 6.8
21+
holdDepth = 18
22+
23+
// calculated variables
24+
retainingLoopSketchAngle1 = asin(housingThicknessHalf / housingR1)
25+
retainingLoopSketchAngle2 = asin(housingThicknessHalf / housingR2)
26+
pointOnRingPolar = polar(angle = retainingLoopSketchAngle2 + 90, length = housingR2 + tolerance)
27+
polarY = pointOnRingPolar[1]
28+
29+
intersectPoint = sqrt(pow(housingR1, exp = 2) - pow(shaftR, exp = 2))
30+
31+
// start modeling section
32+
33+
// start with inner ball
34+
ballSketch = startSketchOn(YZ)
35+
ballProfile = startProfile(ballSketch, at = polar(angle = sketchStartAngle + 90, length = ballRadius))
36+
|> arc(angleStart = sketchStartAngle + 90, angleEnd = 90 - sketchStartAngle, radius = ballRadius)
37+
|> yLine(endAbsolute = 4)
38+
|> xLine(endAbsolute = -ballBoltLength)
39+
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
40+
|> close()
41+
ballRevolve = revolve(ballProfile, angle = 360, axis = X)
42+
|> appearance(%, color = "#519afb")
43+
44+
// next the retaining loop that keep the ball in place
45+
retainingLoopSketch = startSketchOn(YZ)
46+
retainingLoopProfile = startProfile(retainingLoopSketch, at = polar(angle = retainingLoopSketchAngle1 + 90, length = housingR1))
47+
|> arc(angleStart = retainingLoopSketchAngle1 + 90, angleEnd = 90 - retainingLoopSketchAngle1, radius = housingR1)
48+
|> yLine(endAbsolute = polarY)
49+
|> arc(angleStart = -retainingLoopSketchAngle2 + 90, angleEnd = 90 + retainingLoopSketchAngle2, radius = housingR2)
50+
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
51+
|> close()
52+
retainingLoopRevolve = revolve(retainingLoopProfile, angle = 360, axis = X)
53+
54+
intersectPoint2 = polar(angle = -5, length = housingR1 - 0.08)
55+
56+
// the shaft is modeled in two parts, and intersected together
57+
// starting with a revolve
58+
threadedShaftBodyRevolveSketch = startSketchOn(XZ)
59+
threadedShaftBodyRevolveProfile = startProfile(threadedShaftBodyRevolveSketch, at = [0, -distanceBetweenEyeAndShaftEnd])
60+
|> xLine(length = shaftR - 0.07, tag = $seg05) // 0.07 dither to make CSG work
61+
|> yLine(endAbsolute = -intersectPoint, tag = $kink)
62+
|> arc(interiorAbsolute = intersectPoint2, endAbsolute = [housingR1 - 0.08, 0])
63+
// |> line(endAbsolute = [housingR1, 0])
64+
|> xLine(endAbsolute = 0)
65+
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
66+
|> close()
67+
threadedShaftBodyRevolve = revolve(threadedShaftBodyRevolveProfile, angle = 360, axis = Y)
68+
69+
// second part of the shalft is a extrude that will add the flats and the filleted taper to get to the retaining ring width
70+
threadedShaftBodySketch = startSketchOn(-YZ)
71+
threadedShaftBodyProfile = startProfile(threadedShaftBodySketch, at = [0, -distanceBetweenEyeAndShaftEnd - 1])
72+
|> xLine(length = flatsWidth / 2)
73+
|> yLine(endAbsolute = -intersectPoint - 2.5 - 0.11, tag = $longflats)
74+
|> angledLine(tag = $seg01, angle = tapperInAng + 90, endAbsoluteX = housingThicknessHalf - 0.1)
75+
|> yLine(endAbsolute = 0, tag = $seg02)
76+
|> xLine(endAbsolute = -housingThicknessHalf + 0.15)
77+
|> yLine(length = -segLen(seg02), tag = $seg03)
78+
|> angledLine(angle = tapperInAng, endAbsoluteX = -flatsWidth / 2, tag = $seg04)
79+
|> yLine(length = -segLen(longflats))
80+
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
81+
|> close()
82+
threadedShaftBodyFlats = extrude(threadedShaftBodyProfile, length = 40)
83+
|> translate(x = 20, y = 0, z = 0)
84+
|> fillet(radius = 1.9, tags = [getCommonEdge(faces = [seg01, seg02])])
85+
|> fillet(radius = 1.5, tags = [getCommonEdge(faces = [seg03, seg04])])
86+
87+
solid001 = intersect([
88+
threadedShaftBodyRevolve,
89+
threadedShaftBodyFlats
90+
])
91+
sketch005 = startSketchOn(-XZ)
92+
profile005 = circle(sketch005, center = [0, 0], radius = ballRadius - 2)
93+
extrude002 = extrude(profile005, length = 100)
94+
|> translate(x = 0, y = -50, z = 0)
95+
96+
solid002 = subtract([solid001], tools = [extrude002])
97+
// Join the thread body with the retaining loop for the balljoint
98+
solid003 = union([solid002, retainingLoopRevolve])
99+
plane001 = offsetPlane(XY, offset = -distanceBetweenEyeAndShaftEnd - 1)
100+
sketch001 = startSketchOn(plane001)
101+
profile001 = circle(sketch001, center = [0, 0], radius = holeDForM8Tap / 2)
102+
threadedRodHole = extrude(profile001, length = holdDepth + 1)
103+
104+
// cut hole for threaded rod
105+
solid004 = subtract([solid003], tools = [threadedRodHole])

content/pages/docs/kcl-samples/manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
"main.kcl"
2424
]
2525
},
26+
{
27+
"file": "main.kcl",
28+
"pathFromProjectDirectoryToFirstFile": "ball-joint-rod-end/main.kcl",
29+
"multipleFiles": false,
30+
"title": "ball joint rod end",
31+
"description": "A ball joint rod end is a mechanical linkage component that consists of a spherical ball housed within a socket, connected to a threaded rod, allowing rotational movement in multiple directions while providing a secure connection point between two parts of a mechanical system. Commonly used in steering systems and suspension components.",
32+
"files": [
33+
"main.kcl"
34+
]
35+
},
2636
{
2737
"file": "main.kcl",
2838
"pathFromProjectDirectoryToFirstFile": "bench/main.kcl",
83.4 KB
Loading

0 commit comments

Comments
 (0)