Functions

We have support for defining your own functions. Functions can take in any type of argument. Below is an example of the syntax:

As you can see above myFn just returns whatever it is given.

KCL uses keyword arguments:

Functions can also declare one unlabeled arg. If you do want to declare an unlabeled arg, it must be the first arg and prefixed with @, like this:

Point-and-click editability

Custom functions are useful when the same parameterized feature needs to be reused with different inputs. However, Zoo Design Studio's point-and-click tools cannot currently edit sketches inside a custom function body.

Keep sketches at the top level when point-and-click editing is important. Use a custom function when reuse is more important than point-and-click access to its internal sketches. Repeating an identical body usually does not require a custom function; use clone, patternLinear3d, or patternCircular3d instead.

Below shows how a custom function must be called if it has a labeled argument, and another example with an unlabeled argument: