Preparing for the removal of positional functions from the language. The first big step is to change all our KCL code examples, test code, public samples etc to all use keyword functions. Apologies for how large this PR is. Most of it is: - Changing example KCL that defined its own functions, so the functions now use keyword arguments rather than positional arguments. E.g. change `cube([20, 20])` to be `cube(center = [20, 20])`. - Some parts of the code assumed positional code and didn't handle keyword calls, e.g. the linter would only check for positional calls to startSketchOn. Now they should work with either positional or keyword. - Update all the artifacts This does _not_ remove support for positional calls. That will be in a follow-up PR.
24 lines
487 B
Plaintext
24 lines
487 B
Plaintext
fn cube(length, center) {
|
|
l = length / 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 = length)
|
|
}
|
|
|
|
myCube = cube(length = 40, center = [0, 0])
|
|
|
|
// Error, after creating meaningful output.
|
|
foo
|