Files
modeling-app/rust/kcl-lib/tests/misc/cube.kcl

23 lines
489 B
Plaintext
Raw Normal View History

@settings(defaultLengthUnit = mm)
fn cube(sideLength, center) {
l = sideLength / 2
x = center[0]
y = center[1]
p0 = [-l + x, -l + y]
p1 = [-l + x, l + y]
p2 = [l + x, l + y]
p3 = [l + x, -l + y]
return startSketchOn(XY)
|> startProfile(at = p0)
|> line(endAbsolute = p1)
|> line(endAbsolute = p2)
|> line(endAbsolute = p3)
|> line(endAbsolute = p0)
|> close()
|> extrude(length = sideLength)
}
myCube = cube(sideLength = 40, center = [0, 0])