Skip to content

Commit

Permalink
update record initialization method (#118)
Browse files Browse the repository at this point in the history
* update record initialization method

* In the realm of scripts and screens, adding a dash of mechanical dreams.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
r-barton and github-actions[bot] authored Nov 27, 2024
1 parent 0c4d5aa commit 728288a
Show file tree
Hide file tree
Showing 64 changed files with 1,541 additions and 1,379 deletions.
164 changes: 82 additions & 82 deletions 80-20-rail/80-20-rail.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,193 +11,193 @@ fn rail8020 = (originStart, railHeight, railLength) => {
0.1 * railHeight + originStart[1]
], %)
|> arc({
angleStart: 180,
angleEnd: 270,
radius: 0.1 * railHeight
angleStart = 180,
angleEnd = 270,
radius = 0.1 * railHeight
}, %)
|> arc({
angleStart: 180,
angleEnd: 0,
radius: 0.072 / 4 * railHeight
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.1 * railHeight, %)
|> arc({
angleStart: 180,
angleEnd: 0,
radius: 0.072 / 4 * railHeight
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.06 * railHeight, %, $edge1)
|> yLine(0.087 * railHeight, %, $edge2)
|> xLine(-0.183 * railHeight, %, $edge3)
|> angledLineToY({
angle: 45,
to: (1 - 0.356) / 2 * railHeight + originStart[1]
angle = 45,
to = (1 - 0.356) / 2 * railHeight + originStart[1]
}, %, $edge4)
|> xLine(0.232 * railHeight, %, $edge5)
|> angledLineToY({
angle: -45,
to: 0.087 * railHeight + originStart[1]
angle = -45,
to = 0.087 * railHeight + originStart[1]
}, %, $edge6)
|> xLine(-0.183 * railHeight, %, $edge7)
|> yLine(-0.087 * railHeight, %, $edge8)
|> xLine(0.06 * railHeight, %)
|> arc({
angleStart: 180,
angleEnd: 0,
radius: 0.072 / 4 * railHeight
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(0.1 * railHeight, %)
|> arc({
angleStart: 180,
angleEnd: 0,
radius: 0.072 / 4 * railHeight
angleStart = 180,
angleEnd = 0,
radius = 0.072 / 4 * railHeight
}, %)
|> arc({
angleStart: -90,
angleEnd: 0,
radius: 0.1 * railHeight
angleStart = -90,
angleEnd = 0,
radius = 0.1 * railHeight
}, %)

// Sketch side 2 of profile
|> arc({
angleStart: 270,
angleEnd: 90,
radius: 0.072 / 4 * railHeight
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.1 * railHeight, %)
|> arc({
angleStart: 270,
angleEnd: 90,
radius: 0.072 / 4 * railHeight
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.06 * railHeight, %, $edge9)
|> xLine(-0.087 * railHeight, %, $edge10)
|> yLine(-0.183 * railHeight, %, $edge11) // edge11
|> angledLineToX({
angle: 135,
to: ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[0]
angle = 135,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[0]
}, %, $edge12) // edge12
|> yLine(0.232 * railHeight, %, $edge13) // 13
|> angledLineToX({
angle: 45,
to: (1 - 0.087) * railHeight + originStart[0]
angle = 45,
to = (1 - 0.087) * railHeight + originStart[0]
}, %, $edge14) // 14
|> yLine(-0.183 * railHeight, %, $edge15) // 15
|> xLine(0.087 * railHeight, %, $edge16)
|> yLine(0.06 * railHeight, %)
|> arc({
angleStart: 270,
angleEnd: 90,
radius: 0.072 / 4 * railHeight
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(0.1 * railHeight, %)
|> arc({
angleStart: 270,
angleEnd: 90,
radius: 0.072 / 4 * railHeight
angleStart = 270,
angleEnd = 90,
radius = 0.072 / 4 * railHeight
}, %)

// Sketch side 3 of profile
|> arc({
angleStart: 0,
angleEnd: 90,
radius: 0.1 * railHeight
angleStart = 0,
angleEnd = 90,
radius = 0.1 * railHeight
}, %)
|> arc({
angleStart: 0,
angleEnd: -180,
radius: 0.072 / 4 * railHeight
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.1 * railHeight, %)
|> arc({
angleStart: 0,
angleEnd: -180,
radius: 0.072 / 4 * railHeight
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.06 * railHeight, %, $edge17)
|> yLine(-0.087 * railHeight, %, $edge18)
|> xLine(0.183 * railHeight, %, $edge19)
|> angledLineToY({
angle: 45,
to: ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[1]
angle = 45,
to = ((1 - 0.356) / 2 + 0.356) * railHeight + originStart[1]
}, %, $edge20)
|> xLine(-0.232 * railHeight, %, $edge21)
|> angledLineToY({
angle: 135,
to: (1 - 0.087) * railHeight + originStart[1]
angle = 135,
to = (1 - 0.087) * railHeight + originStart[1]
}, %, $edge22)
|> xLine(0.183 * railHeight, %, $edge23)
|> yLine(0.087 * railHeight, %, $edge24)
|> xLine(-0.06 * railHeight, %)
|> arc({
angleStart: 0,
angleEnd: -180,
radius: 0.072 / 4 * railHeight
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> xLine(-0.1 * railHeight, %)
|> arc({
angleStart: 0,
angleEnd: -180,
radius: 0.072 / 4 * railHeight
angleStart = 0,
angleEnd = -180,
radius = 0.072 / 4 * railHeight
}, %)
|> arc({
angleStart: 90,
angleEnd: 180,
radius: 0.1 * railHeight
angleStart = 90,
angleEnd = 180,
radius = 0.1 * railHeight
}, %)

// Sketch side 4 of profile
|> arc({
angleStart: 90,
angleEnd: -90,
radius: 0.072 / 4 * railHeight
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.1 * railHeight, %)
|> arc({
angleStart: 90,
angleEnd: -90,
radius: 0.072 / 4 * railHeight
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.06 * railHeight, %, $edge25)
|> xLine(0.087 * railHeight, %, $edge26)
|> yLine(0.183 * railHeight, %, $edge27)
|> angledLineToX({
angle: 135,
to: (1 - 0.356) / 2 * railHeight + originStart[0]
angle = 135,
to = (1 - 0.356) / 2 * railHeight + originStart[0]
}, %, $edge28)
|> yLine(-0.232 * railHeight, %, $edge29)
|> angledLineToX({
angle: 45,
to: 0.087 * railHeight + originStart[0]
angle = 45,
to = 0.087 * railHeight + originStart[0]
}, %, $edge30)
|> yLine(0.183 * railHeight, %, $edge31)
|> xLine(-0.087 * railHeight, %, $edge32)
|> yLine(-0.06 * railHeight, %)
|> arc({
angleStart: 90,
angleEnd: -90,
radius: 0.072 / 4 * railHeight
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> yLine(-0.1 * railHeight, %)
|> arc({
angleStart: 90,
angleEnd: -90,
radius: 0.072 / 4 * railHeight
angleStart = 90,
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> close(%)

// Sketch center hole of profile
|> hole(circle({
center: [
center = [
.5 * railHeight + originStart[0],
.5 * railHeight + originStart[1]
],
radius: .205 * railHeight / 2
radius = .205 * railHeight / 2
}, %), %)
|> extrude(railLength, %)
|> fillet({
radius: 0.06,
tags: [
radius = 0.06,
tags = [
getNextAdjacentEdge(edge3),
getNextAdjacentEdge(edge4),
getNextAdjacentEdge(edge5),
Expand All @@ -217,8 +217,8 @@ fn rail8020 = (originStart, railHeight, railLength) => {
]
}, %)
|> fillet({
radius: 0.03,
tags: [
radius = 0.03,
tags = [
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge7),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,46 @@ block = startSketchOn('XY')
|> lineTo([-width / 2, length / 2], %)
|> close(%)
|> hole(circle({
center: [
center = [
-(width / 2 - (padding / 2)),
-(length / 2 - (padding / 2))
],
radius: holeDia / 2
radius = holeDia / 2
}, %), %)
|> hole(circle({
center: [
center = [
-(width / 2 - (padding / 2)),
length / 2 - (padding / 2)
],
radius: holeDia / 2
radius = holeDia / 2
}, %), %)
|> hole(circle({
center: [
center = [
width / 2 - (padding / 2),
length / 2 - (padding / 2)
],
radius: holeDia / 2
radius = holeDia / 2
}, %), %)
|> hole(circle({
center: [
center = [
width / 2 - (padding / 2),
-(length / 2 - (padding / 2))
],
radius: holeDia / 2
radius = holeDia / 2
}, %), %)
|> hole(circle({
center: [0, 0],
radius: bearingDia / 2
center = [0, 0],
radius = bearingDia / 2
}, %), %)
|> extrude(height - cbDepth, %)

// Create a second sketch that creates the counterbore diameters and extrude the rest of the way to get the total height. Note: You cannot use startSketchOn(block, 'end'). The extrude lives outside the bounds, and the engine will not execute. This is a known issue.
secondHalf = startSketchOn({
plane: {
origin: { x: 0, y: 0, z: height - cbDepth },
xAxis: { x: 1, y: 0, z: 0 },
yAxis: { x: 0, y: 1, z: 0 },
zAxis: { x: 0, y: 0, z: 1 }
plane = {
origin = { x = 0, y = 0, z = height - cbDepth },
xAxis = { x = 1, y = 0, z = 0 },
yAxis = { x = 0, y = 1, z = 0 },
zAxis = { x = 0, y = 0, z = 1 }
}
})
|> startProfileAt([-width / 2, -length / 2], %)
Expand All @@ -68,35 +68,35 @@ secondHalf = startSketchOn({
|> lineTo([-width / 2, length / 2], %)
|> close(%)
|> hole(circle({
center: [
center = [
-(width / 2 - (padding / 2)),
-(length / 2 - (padding / 2))
],
radius: cbDia / 2
radius = cbDia / 2
}, %), %)
|> hole(circle({
center: [
center = [
-(width / 2 - (padding / 2)),
length / 2 - (padding / 2)
],
radius: cbDia / 2
radius = cbDia / 2
}, %), %)
|> hole(circle({
center: [
center = [
width / 2 - (padding / 2),
length / 2 - (padding / 2)
],
radius: cbDia / 2
radius = cbDia / 2
}, %), %)
|> hole(circle({
center: [
center = [
width / 2 - (padding / 2),
-(length / 2 - (padding / 2))
],
radius: cbDia / 2
radius = cbDia / 2
}, %), %)
|> hole(circle({
center: [0, 0],
radius: bearingDia / 2
center = [0, 0],
radius = bearingDia / 2
}, %), %)
|> extrude(cbDepth, %)
Loading

0 comments on commit 728288a

Please sign in to comment.