DebuggerBreakDisableErrorsFunction used to deactivate all the script lines following errors. Errors that occur in an EKL script after you called DisableErrors is stored in a list. SignatureDisableErrors([iDisableErrors : Boolean, iDisableWarnings : Boolean, iDisableInformations : Boolean]) Arguments
Examplelet resourceToFind(Feature) let resourceName(String) let listOfErrors(List) […] DisableErrors() resourceToFind = AccessResource(resourceName, "Feature") listOfErrors = EnableErrors() if resourceToFind == NULL { /* Treat the case where the resource was not found */ […] } EnableErrors
Function used to re-activate errors and retrieve those that
occurred after you called DisableErrors. It returns a list containing
SignatureEnableErrors() : List ReturnTypeList Examplelet resourceToFind(Feature) let resourceName(String) let listOfErrors(List) […] DisableErrors() resourceToFind = AccessResource(resourceName, "Feature") listOfErrors = EnableErrors() if resourceToFind == NULL { /* Treat the case where the resource was not found */ […] } GetSystemInfoLets you display information related to the execution environment of an EKL script thus enabling the generation of accurate reports. Arguments
ReturnTypeString The function returns the following information:
ExampleNotify("User: #",GetSystemInfo("UserName")) Notify("Current host: #",GetSystemInfo("HostName")) Notify("OS: # - version #", GetSystemInfo("OSName"), GetSystemInfo("OSVersion")) Notify("CATIA Version: #", GetSystemInfo("CATIAVersion")) Notify("Connected Server : #",GetSystemInfo("ServerURL")) Notify("Current Time : #",GetSystemInfo("CurrentTime")) The result of the above example is the following:
IsSetLets you check if an EKL variable is set or lets you unset it. This function is especially useful in KML or in reusable functions. SignatureIsSet(iParamToCheck : ObjectType) : Boolean Note:
This function lets you check if the input value is set.
Unset(iParamToCheck : ObjectType) : Boolean Note:
This function lets you unset the given value.
Arguments
ReturnTypeBoolean Example
OpenTextFileThis function is used to open, close, and write in a text file and read a text file. Arguments
ReturnTypeTextFile Example 1: Open FunctionTo open a file in write mode: let file (TextFile) set file = OpenTextFile("e:\tmp\TextFile1.txt","w") To add lines at the end of the file: set file = OpenTextFile("e:\tmp\TextFile1.txt","a") To read a file: set file = OpenTextFile("e:\tmp\TextFile1.txt","r") Example 2: Close FunctionThis function lets you close a text file. It must be called at the end of the execution to free the memory. let file (TextFile) set file = OpenTextFile("e:\tmp\TextFile1.txt","w") ... file->Close() Example 3: Write FunctionThis function lets you write in a text file. It replaces the whole text in the file if it was opened in “w” mode; Or it adds the string at the end of the file if it was opened in “a” mode. let file (TextFile) let buffer (String) set file = OpenTextFile("e:\tmp\TextFile1.txt","w") buffer = "Hello" file->Write(buffer)The function can also use a given format to write parameters values in the file. In this case, it has two input arguments: the format string and a list of parameters. The convention is “#” for a parameter value and “|” for a line feed. All parameter types are allowed. One writes the unit if any. let parms (List) parms.Append(` Representation316411704 --- IN_WORK\Integer.1` ) parms.Append(` Representation316411704 --- IN_WORK\Real.1` ) parms.Append(` Representation316411704 --- IN_WORK\String.1` ) parms.Append(` Representation316411704 --- IN_WORK\Length.1` ) set file = OpenTextFile("e:\tmp\TextFile1.txt","w") buffer = "Integer = # Real = # |String = #|Length = #" file->Write(buffer,parms) /*Then the text file will contain the values of the parameters with the unit:*/ Integer = 5 Real = 10.23 String = Hello Length = 22mm Example 4: Read FunctionThis function lets you read in a text file. let file (TextFile) let buffer (String) set file = OpenTextFile("e:\tmp\TextFile1.txt","r") set buffer = file->Read() RetrieveSystemPreferenceSignatureRetrieveSystemPreference(PreferencesGroup : String) : SystemPreference Arguments
ReturnTypeSystemPreference RetrieveSystemSettingSignatureRetrieveSystemSetting(SettingGroup : String) : SystemSetting Arguments
ReturnTypeSystemSetting SessionUniqueIndex
Function used to generate an index in EKL. When executing a
script, a unique index is required to name a feature for example. The function
returns a unique index for each value of
Arguments
ReturnTypeInteger clockThis function returns the processor time consumed by the program. To compute the processing time of a program, the value returned by clock must be compared to a value returned by a previous call to the same function. Signatureclock() : Integer ReturnTypeInteger Examplelet tic, tac (integer) tic = clock() let i (integer) i = 1 for i while i <= 55555 { i = i + 1 } tac = clock() Notify("It took me # milliseconds to run this script.", tac-tic) |