Improve KCL Samples (#5767)
* improve KCL Samples & .gitignore * update block and car wheel assembly * update flange and lego, delete flange xy * artifacts Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * scale Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
136
public/kcl-samples/bench/bench-parts.kcl
Normal file
136
public/kcl-samples/bench/bench-parts.kcl
Normal file
@ -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(length = 6.04)
|
||||
|> line(end = [6.68, 7.87])
|
||||
|> tangentialArcTo([10.06, profileStartY(%) - 12.69], %)
|
||||
|> line(end = [7.28, -8.47])
|
||||
|> xLine(length = 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(length = -20)
|
||||
|> arc({
|
||||
angleStart = 90,
|
||||
angleEnd = 180,
|
||||
radius = 10
|
||||
}, %)
|
||||
return sketch005
|
||||
}
|
||||
|
||||
fn armRestProfile(plane, offset) {
|
||||
sketch006 = startSketchOn(plane)
|
||||
|> startProfileAt([offset, 32.4], %)
|
||||
|> xLine(length = 1.3)
|
||||
|> line(end = [0.3, 0.6])
|
||||
|> line(end = [-0.3, 0.6])
|
||||
|> xLine(length = -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
public/kcl-samples/bench/main.kcl
Normal file
34
public/kcl-samples/bench/main.kcl
Normal file
@ -0,0 +1,34 @@
|
||||
// Bench
|
||||
// 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 "bench-parts.kcl"
|
||||
import divider from "bench-parts.kcl"
|
||||
import connector from "bench-parts.kcl"
|
||||
import seatSlats from "bench-parts.kcl"
|
||||
import backSlats from "bench-parts.kcl"
|
||||
import armRest from "bench-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)
|
||||
Reference in New Issue
Block a user