5 May, 2019

## Custom EKL Libraries

Organizations can create and reuse custom EKL
functions as Knowledge Libraries. Creating such libraries requires a KHC license to use the Quality Rules Capture app. However, consuming them does not require KHC. It does however require KDI in order to be able to write EKL code.

A custom EKL Function will behave as a regular EKL function. It takes two types of variables: Inputs, and Outputs. The first is consumed by function where the second is set. For example, you send a function a variable so that it gets set/filled and then returned back. This is how EKL can do recursion–more on that in future posts.

EKL Functions return one object: List, Curve, String, etc. It can also return Void. This object is set within the script using the ToReturn keyword. Calling a custom script requires that we add it to a collaborative space data-set as a Knowledge resource, or add it directly in the Representation containing EKL code inside a Resource Table. Calling the library is done using the include keyword, which must be called at the beginning of the script.

### Sum Example

Here is an example of creating a Sum function.

We can also add description to document what the function does:

Using the function requires that we add the library to a resource table:

### Bounding Rectangle Functions

I build two bounding rectangle functions as custom function. Here is how to use them:

### Importing And Exporting Libraries

This is how you can export a library:

And here is how you import and use it:

### Common EKL Library

I plan on adding more functions to the above library, and of course make it available for public use, for free. If you use it, please consider contributing to new functions to it. Please check out the Contribute Code page for guidelines.

Here is the link to download the 3dxautomation git repo on bitbucket! This version has two functions that I wrote as examples. They need more work to address a variety of cases. I’ll update it as time allows.

Hits: 137

Tags: ,