Contribute Code

Guidelines

I welcome others to submit EKL code to be shared with the broader community of 3D Experience. Here is a few guielines to make submission.

  • Code must be commented–brief notes on what each section does. Please avoid verbose comments unless necessary.
  • Reduce dependency on other custom functions when possible.
  • Limit the scope of your functions so that they become specialized. This will make it easier to compose functions or use them separately.
  • Before making a function, double check if it already exists. If not, check if there is something similar in EKL that can be extended.
  • Make sure that your function confirms the validity of inputs before it uses them. If it is expecting a list of points, then filter that list for points, and make sure it is not NULL.
  • Make use of DisableError and EnableError functions. This is similar to try-catch blocks in C# and On Error Resume Next for VBA.
  • Code submitted for the library must be tested.
  • Code submitted will be made available as per the license below.
  • If you’re contributing code developed for your company or on your company’s machines, please make sure it’s OK for your share it.
  • Start with a preamble explaining what the code does. Inputs it takes (if any), and outputs it returns (if any).

Example

/*
Script: generates bounding disk of a flat polygon, returned as a circle curve.
Input1: polyCurve of type curve.
Output1: disk of type Circle.
*/

//
let polyCurve(Curve)
let disk(Circle)

polyCurve = input1

DisableErrors()
//code to make sure polyCurve is flat.
//code to generate circle
if(EnableErrors().Size()==0)
    disk = ...
else
    disk = NULL

//set the output variable to
Output1 = disk

The above format will writing actions, rules, or custom EKL functions that set output variables. For example, calling the above code will look like this

let mypolygon(Curve)
let myDisk(Circle)

mypolygon = ...

let BoundingDisk(AdvisorAction)
BoundingDisk = ...

//call the action, send it the polygon as input, and the myDisk variable to be set
BoundingDisk( mypolygon, myDisk)

if(myDisk<>NULL){

  //do things...
}

Common EKL Library

Code contributed will be added to a library that is publicly available to download, for free. No copy-rights, nor copy-lefts.