2025-03-06 18:01:24 -05:00
// 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)
2025-05-06 08:44:03 +12:00
@settings(defaultLengthUnit = mm, kclVersion = 1.0)
2025-03-06 18:01:24 -05:00
export dividerThickness = 4
2025-05-01 11:36:51 -05:00
fn dividerSketch(@plane) {
2025-03-06 18:01:24 -05:00
sketch000 = startSketchOn(plane)
2025-04-25 16:01:35 -05:00
|> startProfile(at = [-16.82, 21.2])
2025-03-06 18:01:24 -05:00
|> line(end = [-0.13, -1.27])
2025-04-11 14:17:20 -04:00
|> tangentialArc(endAbsolute = [-15.94, profileStartY(%) - 7.73])
|> tangentialArc(endAbsolute = [-16.6, profileStartY(%) - 15.52])
|> tangentialArc(endAbsolute = [-18.38, profileStartY(%) - 18.63])
2025-03-06 18:01:24 -05:00
|> line(end = [-1.25, -2.6])
2025-03-07 22:07:16 -06:00
|> xLine(length = 6.04)
2025-03-06 18:01:24 -05:00
|> line(end = [6.68, 7.87])
2025-04-11 14:17:20 -04:00
|> tangentialArc(endAbsolute = [10.06, profileStartY(%) - 12.69])
2025-03-06 18:01:24 -05:00
|> line(end = [7.28, -8.47])
2025-03-07 22:07:16 -06:00
|> xLine(length = 5.98)
2025-03-06 18:01:24 -05:00
|> line(end = [-1.3, 3.01])
2025-04-11 14:17:20 -04:00
|> tangentialArc(endAbsolute = [22.45, profileStartY(%) - 2.84])
|> tangentialArc(endAbsolute = [25.08, profileStartY(%) + 6.42])
2025-03-06 18:01:24 -05:00
|> line(end = [2.35, 16.36])
|> line(end = [1.78, 1.15])
2025-04-11 14:17:20 -04:00
|> tangentialArc(endAbsolute = [23.93, profileStartY(%) + 27.29])
2025-03-06 18:01:24 -05:00
|> line(end = [-1.92, 0.21])
|> line(end = [-3.74, -26.54])
2025-04-11 14:17:20 -04:00
|> tangentialArc(endAbsolute = [15.13, profileStartY(%) - 1.72])
|> tangentialArc(endAbsolute = profileStart(%))
2025-03-06 18:01:24 -05:00
|> close()
return sketch000
}
2025-05-01 11:36:51 -05:00
export fn divider(@plane) {
2025-03-06 18:01:24 -05:00
right = dividerSketch(plane)
|> extrude(length = dividerThickness / 2)
left = dividerSketch(plane)
|> extrude(length = -dividerThickness / 2)
2025-04-14 20:37:45 +12:00
shell(right, thickness = 1.5, faces = [END])
shell(left, thickness = 1.5, faces = [START])
2025-03-06 18:01:24 -05:00
return 0
}
2025-05-01 11:36:51 -05:00
fn connectorSketch(@plane, start) {
2025-03-06 18:01:24 -05:00
sketch001 = startSketchOn(plane)
2025-04-25 16:01:35 -05:00
|> startProfile(at = start)
2025-04-21 14:29:32 -04:00
|> polygon(
2025-03-06 18:01:24 -05:00
radius = 1.2,
numSides = 6,
center = profileStart(%),
2025-04-21 14:29:32 -04:00
inscribed = false,
)
2025-03-06 18:01:24 -05:00
return sketch001
}
2025-05-01 11:36:51 -05:00
export fn connector(@plane, length) {
connectorSketch(plane, start = [-12, 8])
2025-05-15 07:42:48 +12:00
|> extrude(length)
2025-05-01 11:36:51 -05:00
connectorSketch(plane, start = [16, 8])
2025-05-15 07:42:48 +12:00
|> extrude(length)
2025-03-06 18:01:24 -05:00
return 0
}
2025-05-01 11:36:51 -05:00
fn seatSlatSketch(@plane) {
2025-03-06 18:01:24 -05:00
sketch003 = startSketchOn(plane)
2025-04-25 16:01:35 -05:00
|> startProfile(at = [-7, 19])
2025-03-06 18:01:24 -05:00
|> 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
}
2025-05-01 11:36:51 -05:00
export fn seatSlats(@plane, length) {
2025-03-06 18:01:24 -05:00
seatSlatSketch(plane)
2025-05-15 07:42:48 +12:00
|> extrude(length)
2025-03-06 18:01:24 -05:00
return 0
}
2025-05-01 11:36:51 -05:00
fn backSlatsSketch(@plane) {
2025-03-06 18:01:24 -05:00
sketch004 = startSketchOn(plane)
2025-04-25 16:01:35 -05:00
|> startProfile(at = [22, 38.5])
KCL: Angled line should use keyword args (#5803)
We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).
Before vs. after:
`angledLine({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, length = 3, tag = $edge)`
`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, lengthX = 3, tag = $edge)`
`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, lengthY = 3, tag = $edge)`
`angledLineToX({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`
`angledLineToY({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
2025-04-09 14:55:15 -05:00
|> angledLine(angle = 173, length = 2)
2025-03-06 18:01:24 -05:00
|> line(end = [-1.74, 2.03])
KCL: Angled line should use keyword args (#5803)
We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).
Before vs. after:
`angledLine({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, length = 3, tag = $edge)`
`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, lengthX = 3, tag = $edge)`
`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, lengthY = 3, tag = $edge)`
`angledLineToX({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`
`angledLineToY({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
2025-04-09 14:55:15 -05:00
|> angledLine(angle = 82, length = 6.6)
2025-03-06 18:01:24 -05:00
|> line(end = [2.23, 1.42])
KCL: Angled line should use keyword args (#5803)
We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).
Before vs. after:
`angledLine({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, length = 3, tag = $edge)`
`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, lengthX = 3, tag = $edge)`
`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, lengthY = 3, tag = $edge)`
`angledLineToX({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`
`angledLineToY({angle = 90, length = 3}, %, $edge)`
=> `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
2025-04-09 14:55:15 -05:00
|> angledLine(angle = -7, length = 2)
2025-03-06 18:01:24 -05:00
|> line(endAbsolute = profileStart(%))
|> close()
|> patternLinear2d(instances = 2, distance = 11, axis = [-0.137, -1])
return sketch004
}
2025-05-01 11:36:51 -05:00
export fn backSlats(@plane, length) {
2025-03-06 18:01:24 -05:00
b = backSlatsSketch(plane)
2025-05-15 07:42:48 +12:00
|> extrude(length)
2025-03-06 18:01:24 -05:00
return b
}
2025-05-01 11:36:51 -05:00
fn armRestPath(@plane) {
2025-03-06 18:01:24 -05:00
sketch005 = startSketchOn(plane)
2025-04-25 16:01:35 -05:00
|> startProfile(at = [20, 33])
2025-03-07 22:07:16 -06:00
|> xLine(length = -20)
2025-04-18 17:40:44 -05:00
|> arc(angleStart = 90, angleEnd = 180, radius = 10)
2025-03-06 18:01:24 -05:00
return sketch005
}
2025-05-01 11:36:51 -05:00
fn armRestProfile(@plane, offset) {
2025-03-06 18:01:24 -05:00
sketch006 = startSketchOn(plane)
2025-04-25 16:01:35 -05:00
|> startProfile(at = [offset, 32.4])
2025-03-07 22:07:16 -06:00
|> xLine(length = 1.3)
2025-03-06 18:01:24 -05:00
|> line(end = [0.3, 0.6])
|> line(end = [-0.3, 0.6])
2025-03-07 22:07:16 -06:00
|> xLine(length = -2.6)
2025-03-06 18:01:24 -05:00
|> line(end = [-0.3, -0.6])
|> line(end = [0.3, -0.6])
|> close()
return sketch006
}
2025-05-01 11:36:51 -05:00
export fn armRest(@plane, offset) {
2025-05-02 16:08:12 -05:00
path = armRestPath(offsetPlane(plane, offset = offset))
2025-05-02 09:16:07 -04:00
profile = armRestProfile(offsetPlane(-XZ, offset = 20), offset = -offset)
2025-03-06 18:01:24 -05:00
sweep(profile, path = path)
return 0
}