KCL stdlib and circle function (#1029)
Allows stdlib functions to be written as KCL, not as Rust. Rust stdlib functions will hereafter be referred to as "core" not "std". Right now the only stdlib function I implemented is a circle function (it's a wrapper around the core arc function which sets the arc's start/end to 0 and 360 respectively). I know I want to change this function as soon as KCL has enums, which is my next task. So, I don't want users to start using this right away. To that end, I've named this function "unstable_stdlib_circle" not "circle". Once the function is ready to be stabilized, I can rename it to just "circle". Note that this PR modifies the existing "sketch and extrude a cylinder" KCL test so that instead of using a user-defined circle function, it uses the unstable_stdlib_circle function now. And the twenty-twenty tests pass, so we know my stdlib is working. https://github.com/KittyCAD/modeling-app/issues/922
This commit is contained in:
@ -1,14 +1,2 @@
|
||||
fn circle = (plane, center, radius) => {
|
||||
const sg = startSketchOn(plane)
|
||||
|> startProfileAt([center[0] + radius, center[1]], %)
|
||||
|> arc({
|
||||
angle_end: 360,
|
||||
angle_start: 0,
|
||||
radius: radius
|
||||
}, %)
|
||||
|> close(%)
|
||||
return sg
|
||||
}
|
||||
|
||||
const cylinder = circle('XY', [0,0], 22) |> extrude(14, %)
|
||||
const cylinder = unstable_stdlib_circle('XY', [0,0], 22) |> extrude(14, %)
|
||||
show(cylinder)
|
||||
|
Reference in New Issue
Block a user