Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boat #141

Merged
merged 45 commits into from
Feb 18, 2025
Merged

boat #141

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f735d3d
boat
r-barton Jan 20, 2025
108ae5e
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 20, 2025
aa6f6d6
Update header of boat-parts.kcl
r-barton Jan 20, 2025
106775e
Merge remote-tracking branch 'origin/barton/3d-boaty' into barton/3d-…
r-barton Jan 20, 2025
4be130f
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 20, 2025
56f2fdc
Add some more clarification to the description
r-barton Jan 21, 2025
e84475c
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 21, 2025
7fe551c
Merge branch 'main' into barton/3d-boaty
r-barton Jan 29, 2025
1af6c8e
Merge branch 'main' into barton/3d-boaty
r-barton Jan 29, 2025
6c6b057
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 29, 2025
8ae7508
Merge branch 'main' into barton/3d-boaty
r-barton Jan 30, 2025
662e2be
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 30, 2025
331f24b
Merge branch 'main' into barton/3d-boaty
r-barton Jan 31, 2025
2ef669e
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 31, 2025
78e2d3c
Merge branch 'main' into barton/3d-boaty
r-barton Jan 31, 2025
58d8924
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 31, 2025
e6f1222
update to latest unit syntax
r-barton Jan 31, 2025
b1f38aa
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Jan 31, 2025
faa3eb1
Merge branch 'main' into barton/3d-boaty
r-barton Feb 5, 2025
999c67d
Update for breaking changes in KCL
r-barton Feb 5, 2025
cc46bfa
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 5, 2025
0dfea4e
Merge branch 'main' into barton/3d-boaty
r-barton Feb 7, 2025
c364b90
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 7, 2025
1511ea0
Merge branch 'main' into barton/3d-boaty
r-barton Feb 11, 2025
0315221
Update for breaking changes in KCL
r-barton Feb 11, 2025
73f3333
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 11, 2025
2851418
Update for breaking changes in KCL
r-barton Feb 11, 2025
c8849af
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 11, 2025
cd61e7d
Merge branch 'main' into barton/3d-boaty
r-barton Feb 11, 2025
2d2943b
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 11, 2025
4df1da4
updated KCL for linear pattern 2d
r-barton Feb 12, 2025
ee3b9d5
Merge branch 'main' into barton/3d-boaty
r-barton Feb 12, 2025
969acbc
updated description
r-barton Feb 12, 2025
f451390
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 12, 2025
cecbab2
Merge branch 'main' into barton/3d-boaty
r-barton Feb 14, 2025
6ea1ed7
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 14, 2025
e17a646
Update process (#168)
adamchalmers Feb 18, 2025
4968279
KCL 37 release (#169)
adamchalmers Feb 18, 2025
9b54c12
Fix assemblies to not rely on import side-effects (#171)
jtran Feb 18, 2025
92421fc
Merge branch 'main' into barton/3d-boaty
r-barton Feb 18, 2025
86ef4fc
update requirements.txt and workflow
r-barton Feb 18, 2025
9f6ead0
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 18, 2025
a82c04f
update for new kw args
r-barton Feb 18, 2025
3fa59e4
Merge remote-tracking branch 'origin/barton/3d-boaty' into barton/3d-…
r-barton Feb 18, 2025
817af98
In the realm of scripts and screens, adding a dash of mechanical dreams.
github-actions[bot] Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/output-from-kcl-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- requirements.txt
branches:
- main
- next
workflow_dispatch:

jobs:
Expand Down
136 changes: 136 additions & 0 deletions 3d-boaty/boat-parts.kcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// 3D Boaty Function Library
// The following file describes various functions to build the 3D boaty. The name of this file is a bit of misnomer, the shape of the object is a typical park bench.

// Set units in millimeters (mm)
@settings(defaultLengthUnit = mm)

export dividerThickness = 4

fn dividerSketch(plane) {
sketch000 = startSketchOn(plane)
|> startProfileAt([-16.82, 21.2], %)
|> line(end = [-0.13, -1.27])
|> tangentialArcTo([-15.94, profileStartY(%) - 7.73], %)
|> tangentialArcTo([-16.6, profileStartY(%) - 15.52], %)
|> tangentialArcTo([-18.38, profileStartY(%) - 18.63], %)
|> line(end = [-1.25, -2.6])
|> xLine(6.04, %)
|> line(end = [6.68, 7.87])
|> tangentialArcTo([10.06, profileStartY(%) - 12.69], %)
|> line(end = [7.28, -8.47])
|> xLine(5.98, %)
|> line(end = [-1.3, 3.01])
|> tangentialArcTo([22.45, profileStartY(%) - 2.84], %)
|> tangentialArcTo([25.08, profileStartY(%) + 6.42], %)
|> line(end = [2.35, 16.36])
|> line(end = [1.78, 1.15])
|> tangentialArcTo([23.93, profileStartY(%) + 27.29], %)
|> line(end = [-1.92, 0.21])
|> line(end = [-3.74, -26.54])
|> tangentialArcTo([15.13, profileStartY(%) - 1.72], %)
|> tangentialArcTo(profileStart(%), %)
|> close()
return sketch000
}

export fn divider(plane) {
right = dividerSketch(plane)
|> extrude(length = dividerThickness / 2)
left = dividerSketch(plane)
|> extrude(length = -dividerThickness / 2)
shell(right, thickness = 1.5, faces = ["end"])
shell(left, thickness = 1.5, faces = ["start"])
return 0
}

fn connectorSketch(plane, start) {
sketch001 = startSketchOn(plane)
|> startProfileAt(start, %)
|> polygon({
radius = 1.2,
numSides = 6,
center = profileStart(%),
inscribed = false
}, %)
return sketch001
}

export fn connector(plane, length) {
connectorSketch(plane, [-12, 8])
|> extrude(length = length)
connectorSketch(plane, [16, 8])
|> extrude(length = length)
return 0
}

fn seatSlatSketch(plane) {
sketch003 = startSketchOn(plane)
|> startProfileAt([-7, 19], %)
|> line(end = [-10, 0.5])
|> line(end = [0.2, 2.5])
|> line(end = [1.5, 1.5])
|> line(end = [6.9, -0.5])
|> line(end = [1.5, -1.5])
|> line(endAbsolute = profileStart(%))
|> close()
|> patternLinear2d(instances = 3, distance = 11, axis = [1, -0.05])
return sketch003
}

export fn seatSlats(plane, length) {
seatSlatSketch(plane)
|> extrude(length = length)
return 0
}

fn backSlatsSketch(plane) {
sketch004 = startSketchOn(plane)
|> startProfileAt([22, 38.5], %)
|> angledLine([173, 2], %)
|> line(end = [-1.74, 2.03])
|> angledLine([82, 6.6], %)
|> line(end = [2.23, 1.42])
|> angledLine([-7, 2], %)
|> line(endAbsolute = profileStart(%))
|> close()
|> patternLinear2d(instances = 2, distance = 11, axis = [-0.137, -1])
return sketch004
}

export fn backSlats(plane, length) {
b = backSlatsSketch(plane)
|> extrude(length = length)
return b
}

fn armRestPath(plane) {
sketch005 = startSketchOn(plane)
|> startProfileAt([20, 33], %)
|> xLine(-20, %)
|> arc({
angleStart = 90,
angleEnd = 180,
radius = 10
}, %)
return sketch005
}

fn armRestProfile(plane, offset) {
sketch006 = startSketchOn(plane)
|> startProfileAt([offset, 32.4], %)
|> xLine(1.3, %)
|> line(end = [0.3, 0.6])
|> line(end = [-0.3, 0.6])
|> xLine(-2.6, %)
|> line(end = [-0.3, -0.6])
|> line(end = [0.3, -0.6])
|> close()
return sketch006
}

export fn armRest(plane, offset) {
path = armRestPath( offsetPlane(plane, offset = offset))
profile = armRestProfile( offsetPlane("-XZ", offset = 20), offset)
sweep(profile, path = path)
return 0
}
34 changes: 34 additions & 0 deletions 3d-boaty/main.kcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 3D Boaty
// This is a slight remix of Depep1's original 3D Boaty (https://www.printables.com/model/1141963-3d-boaty). This is a tool used for benchmarking 3D FDM printers for bed adhesion, overhangs, bridging and top surface quality. The name of this file is a bit of misnomer, the shape of the object is a typical park bench.

// Set units in millimeters (mm)
@settings(defaultLengthUnit = mm)

// Define the bench length
benchLength = 56

// Import various constants and functions from our library
import dividerThickness from "boat-parts.kcl"
import divider from "boat-parts.kcl"
import connector from "boat-parts.kcl"
import seatSlats from "boat-parts.kcl"
import backSlats from "boat-parts.kcl"
import armRest from "boat-parts.kcl"

// Create the dividers, these hold the seat and back slats
divider("YZ")
divider(offsetPlane("-YZ", offset = benchLength / 2))
divider(offsetPlane("YZ", offset = benchLength / 2))

// Create the connectors to join the dividers
connector(offsetPlane("YZ", offset = -benchLength / 2), benchLength)

// Create the seat slats
seatSlats(offsetPlane("YZ", offset = -benchLength / 2 - dividerThickness / 2), benchLength + dividerThickness)

// Create the back slats
backSlats(offsetPlane("YZ", offset = -benchLength / 2 - dividerThickness / 2), benchLength + dividerThickness)

// Create the arm rests
armRest("-YZ", benchLength / 2)
armRest("-YZ", -benchLength / 2)
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The samples can be browsed in our documentation at <https://zoo.dev/docs/kcl-sam

## Guidelines for adding samples

Merge PRs to the `next` branch, not main. When we release Modeling App, we will merge this repo's `next` into `main`. This way, `main` is always compatible with the latest ZMA release.

KCL samples conform to a set of style guidelines to ensure consistency and readability.

1. **File Naming:** Name your KCL files descriptively and concisely, using hyphens to separate words (e.g., flange.kcl, ball-bearing.kcl).
Expand All @@ -23,6 +25,8 @@ KCL samples conform to a set of style guidelines to ensure consistency and reada
When you submit a PR to add or modify KCL samples, images and STEP files will be generated and added to the repository automatically.

---
#### [3d-boaty](3d-boaty/main.kcl) ([step](step/3d-boaty.step)) ([screenshot](screenshots/3d-boaty.png))
[![3d-boaty](screenshots/3d-boaty.png)](3d-boaty/main.kcl)
#### [80-20-rail](80-20-rail/main.kcl) ([step](step/80-20-rail.step)) ([screenshot](screenshots/80-20-rail.png))
[![80-20-rail](screenshots/80-20-rail.png)](80-20-rail/main.kcl)
#### [a-parametric-bearing-pillow-block](a-parametric-bearing-pillow-block/main.kcl) ([step](step/a-parametric-bearing-pillow-block.step)) ([screenshot](screenshots/a-parametric-bearing-pillow-block.png))
Expand Down
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
}, %)
)

12 changes: 6 additions & 6 deletions color-cube/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ metalConstant = 50
roughnessConstant = 50

// Create planes for 6 sides of a cube
bluePlane = offsetPlane('XY', halfSize)
yellowPlane = offsetPlane('XY', -halfSize)
greenPlane = offsetPlane('XZ', -halfSize)
purplePlane = offsetPlane('-XZ', -halfSize)
redPlane = offsetPlane('YZ', halfSize)
tealPlane = offsetPlane('YZ', -halfSize)
bluePlane = offsetPlane('XY', offset = halfSize)
yellowPlane = offsetPlane('XY', offset = -halfSize)
greenPlane = offsetPlane('XZ', offset = -halfSize)
purplePlane = offsetPlane('-XZ', offset = -halfSize)
redPlane = offsetPlane('YZ', offset = halfSize)
tealPlane = offsetPlane('YZ', offset = -halfSize)

// Sketch a rectangle centered at the origin of the profile
fn sketchRectangle (profile, color) {
Expand Down
2 changes: 1 addition & 1 deletion cycloidal-gear/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle) {
// Create a function to draw the gear profile as a sketch. Rotate each profile about the gear's axis by an helix angle proportional to the total gear height
fn gearSketch(gHeight) {
helixAngleP = helixAngle * gHeight / gearHeight
gearProfile = startSketchOn(offsetPlane("XY", gHeight))
gearProfile = startSketchOn(offsetPlane("XY", offset = gHeight))
|> startProfileAt([
gearPitch * 1.55 * cos(toRadians(helixAngleP)) + gearPitch * sin(toRadians(-helixAngleP)),
gearPitch * 1.55 * sin(toRadians(helixAngleP)) + gearPitch * cos(toRadians(-helixAngleP))
Expand Down
Loading
Loading