Skip to content

Commit

Permalink
Update samples for kwarg patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers committed Feb 7, 2025
1 parent 7819932 commit ba0c5c0
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 78 deletions.
12 changes: 6 additions & 6 deletions ball-bearing/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ ballsSketch = startSketchOn("XY")

// Revolve the ball to make a sphere and pattern around the inside wall
balls = revolve({ axis = "X" }, ballsSketch)
|> patternCircular3d({
|> 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")
Expand All @@ -80,13 +80,13 @@ chainSketch = startSketchOn("XY")

// Revolve the chain sketch
chainHead = revolve({ axis = "X" }, chainSketch)
|> patternCircular3d({
|> 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")
Expand All @@ -100,13 +100,13 @@ linkSketch = startSketchOn("XZ")

// Revolve the link sketch
linkRevolve = revolve({ axis = 'Y', angle = 360 / nBalls }, linkSketch)
|> patternCircular3d({
|> patternCircular3d(
arcDegrees = 360,
axis = [0, 0, 1],
center = [0, 0, 0],
instances = nBalls,
rotateDuplicates = true
}, %)
)

// Create the sketch for the outside walls
outsideWallSketch = startSketchOn(customPlane)
Expand Down
16 changes: 8 additions & 8 deletions car-wheel-assembly/car-rotor.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ fn lugPattern(plane) {
center = [-lugSpacing / 2, 0],
radius = 0.315
}, plane)
|> patternCircular2d({
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = lugCount,
rotateDuplicates = true
}, %)
)
return lugHolePattern
}
rotorSketch = startSketchOn(rotorPlane)
Expand Down Expand Up @@ -70,12 +70,12 @@ spacerSketch = startSketchOn(rotorSecondaryPlatePlane)
center = [spacerPatternDiameter / 2, 0],
radius = spacerDiameter
}, %)
|> patternCircular2d({
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = spacerCount,
rotateDuplicates = true
}, %)
)
spacers = extrude(spacerSketch, length = -spacerLength)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
rotorSlottedSketch = startSketchOn(rotor, 'START')
Expand All @@ -85,12 +85,12 @@ rotorSlottedSketch = startSketchOn(rotor, 'START')
|> xLine(-0.12, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d({
|> patternCircular2d(
center = [0, 0],
instances = drillAndSlotCount,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)
rotorSlotted = extrude(rotorSlottedSketch, length = -rotorSinglePlateThickness / 2)

secondRotorSlottedSketch = startSketchOn(secondRotor, 'END')
Expand All @@ -100,11 +100,11 @@ secondRotorSlottedSketch = startSketchOn(secondRotor, 'END')
|> xLine(0.12, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d({
|> patternCircular2d(
center = [0, 0],
instances = drillAndSlotCount,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)
secondRotorSlotted = extrude(secondRotorSlottedSketch, length = -rotorSinglePlateThickness / 2)
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
12 changes: 6 additions & 6 deletions car-wheel-assembly/car-wheel.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ lugClearance = startSketchOn(lugExtrusion, 'END')
center = [lugSpacing / 2, 0],
radius = 1.2 / 2
}, %)
|> patternCircular2d({
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = lugCount,
rotateDuplicates = true
}, %)
)
|> extrude(length = -wheelWidth / 10)

// Create the circular pattern for the lug holes
Expand All @@ -53,12 +53,12 @@ lugHoles = startSketchOn(lugBase, 'END')
center = [lugSpacing / 2, 0],
radius = 16 * mm() / 2
}, %)
|> patternCircular2d({
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = lugCount,
rotateDuplicates = true
}, %)
)
|> extrude(length = -wheelWidth / 20)
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)

Expand Down Expand Up @@ -140,13 +140,13 @@ fn spoke(spokeGap, spokeAngle, spokeThickness) {

// Circular pattern spokes
spokePattern = extrude(spokeProfile, length = spokeThickness)
|> patternCircular3d({
|> patternCircular3d(
axis = [0, 1, 0],
center = [0, -2000, 0],
instances = spokeCount,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
return spokePattern
}
Expand Down
4 changes: 2 additions & 2 deletions car-wheel-assembly/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import lugCount from 'globals.kcl'
carRotor
carWheel
lugNut
|> patternCircular3d({
|> patternCircular3d(
arcDegrees = 360,
axis = [0, 1, 0],
center = [0, 0, 0],
instances = lugCount,
rotateDuplicates = false
}, %)
)

15 changes: 9 additions & 6 deletions dodecahedron/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,31 @@ bottom = extrude(ngon("XY", 5, pentR), length = wallThickness)
bottomSide = extrude(ngon(planeBottomSide, 5, pentR), length = wallThickness)

// Pattern the sides so we have a full dodecahedron
bottomBowl = patternCircular3d({
bottomBowl = patternCircular3d(
bottomSide,
instances = 5,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = true
}, bottomSide)
)

// pattern the bottom to create the top face
patternCircular3d({
patternCircular3d(
bottom,
instances = 2,
axis = [0, 1, 0],
center = [0, 0, inscR],
arcDegrees = 360,
rotateDuplicates = true
}, bottom)
)

// pattern the bottom angled faces to create the top
patternCircular3d({
patternCircular3d(
bottomBowl,
instances = 2,
axis = [0, 1, 0],
center = [0, 0, inscR],
arcDegrees = 360,
rotateDuplicates = true
}, bottomBowl)
)
4 changes: 2 additions & 2 deletions flange-with-patterns/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ circles = startSketchOn('XY')
center = [mountingHolePlacementDiameter / 2, 0],
radius = mountingHoleDia / 2
}, %)
|> patternCircular2d({
|> patternCircular2d(
arcDegrees = 360,
center = [0, 0],
instances = nHoles,
rotateDuplicates = true
}, %)
)

// Create the base of the flange and add the mounting holes
flangeBase = startSketchOn('XY')
Expand Down
8 changes: 4 additions & 4 deletions focusrite-scarlett-mounting-bracket/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ tabsR = startSketchOn(tabPlane)
getNextAdjacentEdge(edge12)
]
}, %)
|> patternLinear3d({
|> patternLinear3d(
axis = [0, -1, 0],
instances = 2,
distance = length + 2 * thk - (tabLength * 4 / 3)
}, %)
)

// build the tabs of the mounting bracket (left side)
tabsL = startSketchOn(tabPlane)
Expand All @@ -125,11 +125,11 @@ tabsL = startSketchOn(tabPlane)
getNextAdjacentEdge(edge22)
]
}, %)
|> patternLinear3d({
|> patternLinear3d(
axis = [0, -1, 0],
instances = 2,
distance = length + 2 * thk - (tabLength * 4 / 3)
}, %)
)

// define a plane for retention bumps
retPlane = {
Expand Down
16 changes: 8 additions & 8 deletions french-press/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ sketch002 = startSketchOn(plane001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 0.75)
|> patternCircular3d({
|> patternCircular3d(
axis = [0, 0, 1],
center = [0, 0, 0],
instances = 4,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)

// Cross plate
sketch003 = startSketchOn(offsetPlane('XY', 1))
Expand All @@ -113,12 +113,12 @@ sketch004 = startSketchOn(extrude001, 'END')
}, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d({
|> patternCircular2d(
center = [0, 0],
instances = 3,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)

extrude002 = extrude(sketch004, length = -0.050)

Expand Down Expand Up @@ -163,24 +163,24 @@ extrude003 = extrude(sketch007, length = 0.050)
// Pattern holes in the spiral plate
sketch008 = startSketchOn(extrude003, 'END')
|> circle({ center = [1.4, 0], radius = .3 }, %)
|> patternCircular2d({
|> patternCircular2d(
center = [0, 0],
instances = 8,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)

extrude004 = extrude(sketch008, length = -0.050)

// Pattern holes in the spiral plate
sketch009 = startSketchOn(extrude003, 'END')
|> circle({ center = [0.6, 0], radius = .2 }, %)
|> patternCircular2d({
|> patternCircular2d(
center = [0, 0],
instances = 4,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)

extrude005 = extrude(sketch009, length = -0.050)

Expand Down
4 changes: 2 additions & 2 deletions gear-rack/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ fn tooth() {

// Pattern the single tooth over the length of the rack body
teeth = tooth()
|> patternLinear3d({
|> patternLinear3d(
axis = [10, 0, 0],
distance = 1.570796,
instances = 63
}, %)
)

// Sketch and extrude the first end cap. This is a partial tooth
endCapTooth = startSketchOn('XY')
Expand Down
4 changes: 2 additions & 2 deletions gear/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ teeth = reduce([0..100], start, leftInvolute)
|> reduce([1..101], %, rightInvolute)
|> close()
|> extrude(length = gearHeight)
|> patternCircular3d({
|> patternCircular3d(
axis = [0, 0, 1],
center = [0, 0, 0],
instances = nTeeth,
arcDegrees = 360,
rotateDuplicates = true
}, %)
)

// Define the constants of the keyway and the bore hole
keywayWidth = 0.250
Expand Down
16 changes: 8 additions & 8 deletions lego/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ peg = startSketchOn(s, 'end')
],
radius = bumpDiam / 2
}, %)
|> patternLinear2d({
|> patternLinear2d(
axis = [1, 0],
instances = wbumps,
distance = pitch
}, %)
|> patternLinear2d({
)
|> patternLinear2d(
axis = [0, 1],
instances = lbumps,
distance = pitch
}, %)
)
|> extrude(length = bumpHeight)

// Create the pegs on the bottom of the base
Expand All @@ -96,14 +96,14 @@ tubePattern = startSketchOn(tubeFace)
],
radius = bumpDiam / 2
}, %)
|> patternLinear2d({
|> patternLinear2d(
axis = [1, 0],
instances = wbumps - 1,
distance = pitch
}, %)
|> patternLinear2d({
)
|> patternLinear2d(
axis = [0, 1],
instances = lbumps - 1,
distance = pitch
}, %)
)
|> extrude(length = -bumpHeight)
Loading

0 comments on commit ba0c5c0

Please sign in to comment.