Files
modeling-app/rust/kcl-lib/tests/misc/cube.kcl
Jonathan Tran 819ee23565 Fix to cache correct PathToNode in artifact graph (#6632)
* Add NodePath to artifact graph

Since this is cached, this should make PathToNode computation correct
even when code is formatted, whitespace changes, and source ranges
are different.

* Remove dead code

* Add unit tests

* Add tests for PathToNode conversion

* Remove unused parameter

* Add missing PathToNode cases

* Fix to handle unlabeled arg

* Cherry pick unlabeled arg fix

* Change PathToNode comment to match TS implementation
2025-05-01 23:55:12 -04:00

23 lines
489 B
Plaintext

@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])