Skip to content

Commit

Permalink
Update KCL samples for kwargs work (#139)
Browse files Browse the repository at this point in the history
* Update KCL samples for kwargs work

* Fix regex mistakes

* Fix car wheel assembly: tire

* Fix spatula

* Fix gear

* Fix walkie-talkie

* Fix spatula

* Fix car wheel

* Remove ds store

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

* Fix

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

* Update for zoo-kcl v0.2.5

* 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>
Co-authored-by: Ryan Barton <[email protected]>
  • Loading branch information
3 people authored Feb 5, 2025
1 parent 4cdc5ce commit 13543b7
Show file tree
Hide file tree
Showing 90 changed files with 492 additions and 490 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions 80-20-rail/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn rail8020(originStart, railHeight, railLength) {
angleEnd = -90,
radius = 0.072 / 4 * railHeight
}, %)
|> close(%)
|> close()

// Sketch center hole of profile
|> hole(circle({
Expand All @@ -196,7 +196,7 @@ fn rail8020(originStart, railHeight, railLength) {
],
radius = .205 * railHeight / 2
}, %), %)
|> extrude(railLength, %)
|> extrude(length = railLength)
|> fillet({
radius = 0.06,
tags = [
Expand Down
20 changes: 10 additions & 10 deletions a-parametric-bearing-pillow-block/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ bearingDia = 3
// (Needs to be updated). Sketch the block and extrude up to where the counterbore diameter starts.
block = startSketchOn('XY')
|> startProfileAt([-width / 2, -length / 2], %)
|> lineTo([width / 2, -length / 2], %)
|> lineTo([width / 2, length / 2], %)
|> lineTo([-width / 2, length / 2], %)
|> close(%)
|> line(endAbsolute = [width / 2, -length / 2])
|> line(endAbsolute = [width / 2, length / 2])
|> line(endAbsolute = [-width / 2, length / 2])
|> close()
|> hole(circle({
center = [
-(width / 2 - (padding / 2)),
Expand Down Expand Up @@ -53,7 +53,7 @@ block = startSketchOn('XY')
center = [0, 0],
radius = bearingDia / 2
}, %), %)
|> extrude(height - cbDepth, %)
|> extrude(length = 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({
Expand All @@ -65,10 +65,10 @@ secondHalf = startSketchOn({
}
})
|> startProfileAt([-width / 2, -length / 2], %)
|> lineTo([width / 2, -length / 2], %)
|> lineTo([width / 2, length / 2], %)
|> lineTo([-width / 2, length / 2], %)
|> close(%)
|> line(endAbsolute = [width / 2, -length / 2])
|> line(endAbsolute = [width / 2, length / 2])
|> line(endAbsolute = [-width / 2, length / 2])
|> close()
|> hole(circle({
center = [
-(width / 2 - (padding / 2)),
Expand Down Expand Up @@ -101,4 +101,4 @@ secondHalf = startSketchOn({
center = [0, 0],
radius = bearingDia / 2
}, %), %)
|> extrude(cbDepth, %)
|> extrude(length = cbDepth)
12 changes: 6 additions & 6 deletions ball-bearing/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ insideWallSketch = startSketchOn(customPlane)
}, %), %)

// Extrude the inside bearing piece
insideWall = extrude(overallThickness, insideWallSketch)
insideWall = extrude(insideWallSketch, length = overallThickness)

// Create the sketch of one of the balls
ballsSketch = startSketchOn("XY")
Expand All @@ -51,7 +51,7 @@ ballsSketch = startSketchOn("XY")
angleStart = 180,
radius = sphereDia / 2
}, %)
|> close(%)
|> close()

// Revolve the ball to make a sphere and pattern around the inside wall
balls = revolve({ axis = "X" }, ballsSketch)
Expand All @@ -74,9 +74,9 @@ chainSketch = startSketchOn("XY")
angleStart = 120,
radius = sphereDia / 2
}, %)
|> line([0, chainThickness], %)
|> line([-chainWidth, 0], %)
|> close(%)
|> line(end = [0, chainThickness])
|> line(end = [-chainWidth, 0])
|> close()

// Revolve the chain sketch
chainHead = revolve({ axis = "X" }, chainSketch)
Expand Down Expand Up @@ -119,6 +119,6 @@ outsideWallSketch = startSketchOn(customPlane)
radius = shaftDia / 2 + wallThickness + sphereDia
}, %), %)

outsideWall = extrude(overallThickness, outsideWallSketch)
outsideWall = extrude(outsideWallSketch, length = overallThickness)

// https://www.mcmaster.com/60355K185/
26 changes: 13 additions & 13 deletions bracket/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is
// Sketch the bracket body and fillet the inner and outer edges of the bend
bracketLeg1Sketch = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([shelfMountL - filletRadius, 0], %, $fillet1)
|> line([0, width], %, $fillet2)
|> line([-shelfMountL + filletRadius, 0], %)
|> close(%)
|> line(end = [shelfMountL - filletRadius, 0], tag = $fillet1)
|> line(end = [0, width], tag = $fillet2)
|> line(end = [-shelfMountL + filletRadius, 0])
|> close()
|> hole(circle({
center = [1, 1],
radius = mountingHoleDiameter / 2
Expand All @@ -48,7 +48,7 @@ bracketLeg1Sketch = startSketchOn('XY')
}, %), %)

// Extrude the leg 2 bracket sketch
bracketLeg1Extrude = extrude(thickness, bracketLeg1Sketch)
bracketLeg1Extrude = extrude(bracketLeg1Sketch, length = thickness)
|> fillet({
radius = extFilletRadius,
tags = [
Expand All @@ -60,21 +60,21 @@ bracketLeg1Extrude = extrude(thickness, bracketLeg1Sketch)
// Sketch the fillet arc
filletSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0, thickness], %)
|> line(end = [0, thickness])
|> arc({
angleEnd = 180,
angleStart = 90,
radius = filletRadius + thickness
}, %)
|> line([thickness, 0], %)
|> line(end = [thickness, 0])
|> arc({
angleEnd = 90,
angleStart = 180,
radius = filletRadius
}, %)

// Sketch the bend
filletExtrude = extrude(-width, filletSketch)
filletExtrude = extrude(filletSketch, length = -width)

// Create a custom plane for the leg that sits on the wall
customPlane = {
Expand All @@ -89,10 +89,10 @@ customPlane = {
// Create a sketch for the second leg
bracketLeg2Sketch = startSketchOn(customPlane)
|> startProfileAt([0, -filletRadius], %)
|> line([width, 0], %)
|> line([0, -wallMountL], %, $fillet3)
|> line([-width, 0], %, $fillet4)
|> close(%)
|> line(end = [width, 0])
|> line(end = [0, -wallMountL], tag = $fillet3)
|> line(end = [-width, 0], tag = $fillet4)
|> close()
|> hole(circle({
center = [1, -1.5],
radius = mountingHoleDiameter / 2
Expand All @@ -103,7 +103,7 @@ bracketLeg2Sketch = startSketchOn(customPlane)
}, %), %)

// Extrude the second leg
bracketLeg2Extrude = extrude(-thickness, bracketLeg2Sketch)
bracketLeg2Extrude = extrude(bracketLeg2Sketch, length = -thickness)
|> fillet({
radius = extFilletRadius,
tags = [
Expand Down
34 changes: 17 additions & 17 deletions car-wheel-assembly/brake-caliper.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,71 +25,71 @@ brakeCaliperSketch = startSketchOn(brakeCaliperPlane)
rotorDiameter / 2 + caliperTolerance,
0
], %)
|> line([
|> line(end = [
0,
rotorTotalThickness + caliperTolerance - caliperInnerEdgeRadius
], %)
])
|> tangentialArc({
offset = 90,
radius = caliperInnerEdgeRadius
}, %)
|> line([
|> line(end = [
-caliperPadLength + 2 * caliperInnerEdgeRadius,
0
], %)
])
|> tangentialArc({
offset = -90,
radius = caliperInnerEdgeRadius
}, %)
|> line([
|> line(end = [
0,
caliperThickness - (caliperInnerEdgeRadius * 2)
], %)
])
|> tangentialArc({
offset = -90,
radius = caliperInnerEdgeRadius
}, %)
|> line([
|> line(end = [
caliperPadLength + caliperThickness - caliperOuterEdgeRadius - caliperInnerEdgeRadius,
0
], %)
])
|> tangentialArc({
offset = -90,
radius = caliperOuterEdgeRadius
}, %)
|> line([
|> line(end = [
0,
-2 * caliperTolerance - (2 * caliperThickness) - rotorTotalThickness + 2 * caliperOuterEdgeRadius
], %)
])
|> tangentialArc({
offset = -90,
radius = caliperOuterEdgeRadius
}, %)
|> line([
|> line(end = [
-caliperPadLength - caliperThickness + caliperOuterEdgeRadius + caliperInnerEdgeRadius,
0
], %)
])
|> tangentialArc({
offset = -90,
radius = caliperInnerEdgeRadius
}, %)
|> line([
|> line(end = [
0,
caliperThickness - (2 * caliperInnerEdgeRadius)
], %)
])
|> tangentialArc({
offset = -90,
radius = caliperInnerEdgeRadius
}, %)
|> line([
|> line(end = [
caliperPadLength - (2 * caliperInnerEdgeRadius),
0
], %)
])
|> tangentialArc({
offset = 90,
radius = caliperInnerEdgeRadius
}, %)
|> close(%)
|> close()

// Revolve the brake caliper sketch
export brakeCaliper = revolve({ axis = "Y", angle = -70 }, brakeCaliperSketch)
Expand Down
22 changes: 11 additions & 11 deletions car-wheel-assembly/car-rotor.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ rotorSketch = startSketchOn(rotorPlane)
radius = rotorDiameter / 2
}, %)
|> hole(lugPattern(%), %)
rotor = extrude(rotorSinglePlateThickness, rotorSketch)
rotor = extrude(rotorSketch, length = rotorSinglePlateThickness)
|> appearance({
color = "#dbcd70",
roughness = 90,
Expand All @@ -46,7 +46,7 @@ rotorBumpSketch = startSketchOn(rotorPlane)
radius = rotorInnerDiameter / 2
}, %)
|> hole(lugPattern(%), %)
rotorBump = extrude(-rotorInnerDiameterThickness, rotorBumpSketch)
rotorBump = extrude(rotorBumpSketch, length = -rotorInnerDiameterThickness)
|> appearance({
color = "#dbcd70",
roughness = 90,
Expand All @@ -70,7 +70,7 @@ secondaryRotorSketch = startSketchOn(rotorSecondaryPlatePlane)
radius = rotorDiameter / 2
}, %)
|> hole(lugPattern(%), %)
secondRotor = extrude(rotorSinglePlateThickness, secondaryRotorSketch)
secondRotor = extrude(secondaryRotorSketch, length = rotorSinglePlateThickness)
spacerSketch = startSketchOn(rotorSecondaryPlatePlane)
|> circle({
center = [spacerPatternDiameter / 2, 0],
Expand All @@ -82,7 +82,7 @@ spacerSketch = startSketchOn(rotorSecondaryPlatePlane)
instances = spacerCount,
rotateDuplicates = true
}, %)
spacers = extrude(-spacerLength, spacerSketch)
spacers = extrude(spacerSketch, length = -spacerLength)
|> appearance({
color = "#dbcd70",
roughness = 90,
Expand All @@ -93,32 +93,32 @@ rotorSlottedSketch = startSketchOn(rotor, 'START')
|> xLine(0.12, %)
|> yLine(2.56, %)
|> xLine(-0.12, %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d({
center = [0, 0],
instances = drillAndSlotCount,
arcDegrees = 360,
rotateDuplicates = true
}, %)
rotorSlotted = extrude(-rotorSinglePlateThickness / 2, rotorSlottedSketch)
rotorSlotted = extrude(rotorSlottedSketch, length = -rotorSinglePlateThickness / 2)

secondRotorSlottedSketch = startSketchOn(secondRotor, 'END')
|> startProfileAt([-2.17, 2.56], %)
|> xLine(-0.12, %)
|> yLine(2.56, %)
|> xLine(0.12, %)
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d({
center = [0, 0],
instances = drillAndSlotCount,
arcDegrees = 360,
rotateDuplicates = true
}, %)
secondRotorSlotted = extrude(-rotorSinglePlateThickness / 2, secondRotorSlottedSketch)
secondRotorSlotted = extrude(secondRotorSlottedSketch, length = -rotorSinglePlateThickness / 2)
|> appearance({
color = "#dbcd70",
roughness = 90,
metalness = 90
}, %)
}, %)
32 changes: 16 additions & 16 deletions car-wheel-assembly/car-tire.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ import tireInnerDiameter, tireOuterDiameter, tireDepth, bendRadius, tireTreadWid
// Create the sketch of the tire
tireSketch = startSketchOn("XY")
|> startProfileAt([tireInnerDiameter / 2, tireDepth / 2], %)
|> lineTo([
|> line(endAbsolute = [
tireOuterDiameter / 2 - bendRadius,
tireDepth / 2
], %, $edge1)
], tag = $edge1)
|> tangentialArc({ offset = -90, radius = bendRadius }, %)
|> lineTo([
|> line(endAbsolute = [
tireOuterDiameter / 2,
tireDepth / 2 - tireTreadOffset
], %)
|> line([-tireTreadDepth, 0], %)
|> line([0, -tireTreadWidth], %)
|> line([tireTreadDepth, 0], %)
|> lineTo([
])
|> line(end = [-tireTreadDepth, 0])
|> line(end = [0, -tireTreadWidth])
|> line(end = [tireTreadDepth, 0])
|> line(endAbsolute = [
tireOuterDiameter / 2,
-tireDepth / 2 + tireTreadOffset + tireTreadWidth
], %)
|> line([-tireTreadDepth, 0], %)
|> line([0, -tireTreadWidth], %)
|> line([tireTreadDepth, 0], %)
|> lineTo([
])
|> line(end = [-tireTreadDepth, 0])
|> line(end = [0, -tireTreadWidth])
|> line(end = [tireTreadDepth, 0])
|> line(endAbsolute = [
tireOuterDiameter / 2,
-tireDepth / 2 + bendRadius
], %)
])
|> tangentialArc({ offset = -90, radius = bendRadius }, %)
|> lineTo([tireInnerDiameter / 2, -tireDepth / 2], %, $edge2)
|> close(%)
|> line(endAbsolute = [tireInnerDiameter / 2, -tireDepth / 2], tag = $edge2)
|> close()

// Revolve the sketch to create the tire
export carTire = revolve({ axis = "Y" }, tireSketch)
Expand Down
Loading

0 comments on commit 13543b7

Please sign in to comment.