0% found this document useful (0 votes)
2K views51 pages

DS WhitePapers Enterprise Knowledge Language Overview and Usage V1.0

Uploaded by

fibrilado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views51 pages

DS WhitePapers Enterprise Knowledge Language Overview and Usage V1.0

Uploaded by

fibrilado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Best Practices

Enterprise Knowledge Language


Overview and Usage

© Dassault Systèmes | Confidential Information| ref.: 3DS_Document_2020

Version 1.0 - 8/7/2020

Written by: Onkar PATOLE


Validated by: Thomas VIDECOQ
Edited by: Arati DESAI

3DEXPERIENCE Platform R2020x


Best Practices

Executive Summary
This document provides an overview of main concepts about the EKL, EKL
Capabilities, various functions and tools that are required to work with EKL, and
troubleshooting EKL Code. The objective is to help users get a better
understanding about the EKL.

This document also provides some sample examples about using various types of
EKL functions that will help the users to get started with EKL.

The target audience for this Best Practices document is Designers and
Administrators who are looking for information about Enterprise Knowledge
Language (EKL).

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

2
Best Practices

Table of contents
1. Introduction .................................................................................................................... 5
1.1. EKL Capabilities ......................................................................................................... 5
2. About EKL...................................................................................................................... 6
2.1. Understanding the Structure of EKL ........................................................................... 6
2.2. Object Types Hierarchy .............................................................................................. 8
2.3. Understanding EKL Terms ......................................................................................... 9
3. Defining Syntax in EKL ................................................................................................ 11
4. About EKL Editors........................................................................................................ 15
4.1. EKL Editor Interface ................................................................................................. 15
4.2. Knowledge Editor Toolbar ........................................................................................ 16
4.3. Language Browser ................................................................................................... 17
5. How to create an Action ............................................................................................... 19

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


6. Using Actions with Catalogs ......................................................................................... 20
6.1. Inserting an Action in a Catalog ................................................................................ 20
6.2. Reusing an Action from a Catalog ............................................................................ 21
7. Working with Knowledge Resources ............................................................................ 22
8. Message Functions used in EKL .................................................................................. 23
8.1. Message and Popup Message ................................................................................. 23
8.2. Notify Message......................................................................................................... 24
8.3. Report Message ....................................................................................................... 24
9. About Know-how Libraries ........................................................................................... 25
10. Debugging the EKL Issues ....................................................................................... 28
10.1. Using the EKL Debugger ...................................................................................... 28
10.2. Capabilities of Debugger Window ......................................................................... 29
10.3. Debugging EKL Using Knowledge Monitor ........................................................... 30
10.3.1. Enable Knowledge Monitor ................................................................................ 30
10.4. Knowledge Monitor Window .................................................................................. 31
10.5. Error Handling....................................................................................................... 32
11. Sample Scripts ......................................................................................................... 33
11.1. Navigating Through Product Objects .................................................................... 33
11.2. Creating New Product Objects .............................................................................. 38
11.3. Retrieving the Position Matrix of an Instance ........................................................ 39
11.4. Working with External Files ................................................................................... 41

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

3
Best Practices

12. About Getting Started ............................................................................................... 47


13. References ............................................................................................................... 50
14. Document History ..................................................................................................... 51

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

4
Best Practices

1. Introduction
Knowledgeware solutions deliver a set of tools that help users to define, reuse, and share their
know-how throughout the extended enterprise. Knowledgeware is also tailored to support
customer business processes, enabling the customization of Product Lifecycle Management
(PLM) behaviors and applications through the Business Rules.

Enterprise Knowledge Language (EKL) is a programming language in V5 &


V6/3DEXPERIENCE. It is intended for the development of smart models or applications and
their integration in a more general context.

EKL is a DS, portable, object oriented, interpreted, Automation language that directly
manipulates the V6 objects:

 DS: designed, engineered, and maintained by Dassault Systèmes


 Portable: independent from OS
 Object Oriented: manipulates objects with methods
 Interpreted: does not require compilation
 Automation: enables to create & manipulate existing classes but does not enable to

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


declare new classes. There is an extension called KML that adds some object
modeling capability. This is part of Design Apps Developer Role (KAC).
 V6 objects: provides native access to V6 constructs

There are two versions of EKL:

 One running on the rich client as mentioned above.


 One running on the server, with some slight differences in the basic syntax but with a
different content. This one is presently used only for business rules executed on the
server.

1.1. EKL Capabilities


Using EKL, one can search for objects in the database, navigate through different structures,
create Products and PLM Objects in general, Instantiate templates, export data into Excel
and XML, set or read attributes.

UI creation (like VBA Forms) is possible using Know-how Apps User Experience app. This
app is available with a Design Apps Developer role (KAC).

With the new “web dialog” dialog box which uses web in win, the user can now build a UI
using html/js. This allows the user to have an interactive panel based on individual
requirement.

EKL execution is a blocking as well as a synchronous process.

LIMITATIONS:
EKL works only with in-session data. When used in the context of Business Rules,

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

5
Best Practices

interaction with files like Excel & XML stored in the file system is not possible. However, if
you store the files as Resources, you can use such files in the Business Rules.

It is also not possible to call a VBA macro from an EKL feature but, you can call the Visual
Basic Actions.

2. About EKL

2.1. Understanding the Structure of EKL


V6 objects are manipulated using a federated object model composed of the following:

1. Types: A hierarchy of types (one type inherits only from one type)
2. Attributes: Each type has a list of attributes:
 Simple (Boolean, string, real, integer, and so on..)
 Reference to other objects
 List (of values or reference objects)

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


 Components (aggregated objects or list of aggregated objects)
 Functions and Methods: Some Functions and Methods defined on types
 Argument: Functions and methods have a list of arguments.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

6
Best Practices

EKL is defined in four layers from the very simple Mathematical language (M-EKL) to the
most complete Advanced language (A-EKL).

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


 Mathematical Enterprise Language (M-EKL)

Groups the language operators and numerical functions (math, measures, …)


necessary to express the sets of equations used to valuate parameters in
Engineering Rules Capture.

 Core Enterprise Language (C-EKL)

It is used in the following Knowledge artifacts that are related to the update process
through their parameters:

o Formulas
o Design tables functions
o Rules and checks provided in the Engineering Rules Capture app.
o Constraints satisfaction feature provided in Design Optimization.

 Advanced Enterprise Language (A-EKL)

It provides a way to manipulate features as Knowledge Objects:

o Basic attributes and methods


o Search capabilities
o Value pointers manipulation
o Application-specific services

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

7
Best Practices

o Extensible Enterprise Language (X-EKL)

It contains the applicative packages available in EKL. You can also use X-EKL to add
functions to the EKL language.

2.2. Object Types Hierarchy


The following image displays hierarchy of Object Types.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

8
Best Practices

 Object Type
o A V6 object type describes classification of all the
V6 objects depending on the characteristics and
behaviour of the object. A V6 object type always
inherits types from another object type except the
“Feature” Type.
 Value Type
o The system provides different types of values
such as Integer, Real, Boolean, String, and all the
magnitudes (LENGTH, VISCOSITY, etc…). The
mix of value and object types provides a coherent
typing environment.
 Feature (Core types & functions)
o All applicative types are inheriting from a basic
object type called “Feature” which means that
Feature is the basic type for all objects in V6.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


o Feature type is the basic type for all objects in V6
(all objects inherit from this type).
o Feature type enables to manipulate the V6 object
mode, in a generic way, by:
 Naming and Commenting
 Typing and Attributes
 Navigation in the tree
 Reading and writing attributes
 Creating and deleting Objects

2.3. Understanding EKL Terms


This section provides further understanding on how an EKL is built and how to use it.

 Units Management: Managed in meter-kilo-second system, where the unit coherence


is verified.

 Objects may support multiple types (a Product may support VPMReference,


PLMCoreReference, Feature, and so on)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

9
Best Practices

 Some functions have variable or optional arguments. It is possible to replace variable


arguments with a list.

Replacing variable arguments by list, raises some concerns with polymorphism


(when several functions have the same name but not the same arguments types).
For example, we cannot make a difference between assemble (list of curves) and

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


assemble (list of surfaces).
This can be solved as follows:
assemble (first surface, list of other surfaces)
assemble (first curve, list of other curves)

 In most usages of EKL, rules are created in the context of a particular model. This
model usually contains parameters (values that can be read or written), variables that
reference isolated geometries, or objects (that can be used as input)

 User can select variables and objects directly in the Engineering Rules Capture app to
use inside the rules and can be passed as arguments of functions, methods, and
operators.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

10
Best Practices

3. Defining Syntax in EKL


This section explains the concepts of defining syntax in EKL.

 To add Comments in your scripts:

“//” used for comments

 Variable declaration
o User can declare variables anywhere in the code and the scope of variable
depends on where they are declared.
 Let NameoftheVariable(Type)

 Where “Let ” is the keyword and the statement of the variable definition.
 “NameoftheVariable” is the variable name and “(Type)” is the object’s internal

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


type in EKL.

o You can use the Set keyword for type casting the variable. Set keyword performs
the assignment without checking the type. The result is NULL for a non-supported
type.

o Multiple variable declaration is supported like

Let r1, r2 (Real)

There are two ways to provide strings: use double quotes (“ “) as delimiters, or
single quote (‘ ‘) as delimiters. You can have strings within strings by combining
both.

 Operators

These will allow you to manipulate and compare variables and other inputs, used
throughout the code

o +, -, *, /, =, **  Arithmetic operators
o ==, <, >, <=, =>, <>  Comparison operators
o like, unlike  Allows to test if an object belongs to a certain type
o And, Or  Logical Operators
 Loops
EKL provides two types of loops:
o The first type of loop allows to iterate on an integer variable until a criterion is
reached. It uses the ‘for’ and ‘while’ keywords. There is a default increment but it
is not used if the loop code explicitly modifies the loop variable.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

11
Best Practices

o The other loops on all objects of a type within a collection. It uses the ‘for’ and
‘inside’ keywords.

 For <variable name> while <condition>

The following script will return an item in the list closest to the iNbr value
where iList is a list containing Integers.

Let compare, i, tmp(Integer)


oResult = iList[1]
compare = abs(oResult - iNbr)

for i = 2 while i <= iList->Size()


{
tmp = iList[i]
if(abs(tmp - iNbr) < compare )
{
compare = abs(tmp - iNbr)
oResult = tmp
}

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


else if(iList[i] == oResult )
{
if(tmp > 0)
oResult = tmp
}
}

Note:
With this release, initialization of the increment variable within the loop
definition is now supported:
For i = 1 while
The variable is incremented automatically (+1) but can be overloaded.
In case the user does not want to make the increment then overlaoding is not
supported and may raise a problem in some cases.

 For <variable name> inside <list variable name>

Loops based on the elements of a List

 Break statement: is used to exit a loop from any point within its body. When
the script is interrupted, the script evaluation goes directly to the instruction
located directly after the loop.
Let i,result (Integer)
result = 0

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

12
Best Practices

i = 1
for i while i < lines.Size()
{
result = length(lines[i])
if result > 100mm
{
break
}
}

The above script computes the total length of several lines and stops computing
once the total length is greater to 100mm.

 Continue statement: after calling continue, the script goes directly to the first
instruction of the loop to start the next iteration.
Let i (Integer)
Let localResult(Real)
Let resultsList(List)
i = 1

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


for i while i < numerators.Size()
{ If divisor[i] <> 0
{
localResult = numerators[i]/divisors[i]
if localResult[i] < 0
{ // This result is not interesting,
let’s go to the next iteration

continue
}
Else
{
resultsList.Append(localResult)
}
}
}

 Exit statement: stops execution of the script. It is used to handle error


scenarios when the situation becomes impossible to recover.
Let i(Integer)
Let totalWeight(Integer)
for i while I <= points.Size()
{
totalWeight = totalWeight + pointsWeight[i]
}
If totalWeight == 0
{
// Forbidden case
exit
}

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

13
Best Practices

Computes the total weight of n points

 If …. else if … else

No Parenthesis { } required for If there is only


one line of execution

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


 Ternary operator
o Provides the user with an abbreviated if... then ... else condition and gives a way
to use conditions in formulas.
o Syntax: predicate ? rightvalue ; falsevalue
Let p,q,r (Point)
p=point(1mm,2mm,3mm)
q=point(4mm,5mm,6mm)
r = distance(p,q)> 2mm ? point(7mm,8mm,9mm) ;
point(10mm,11mm,12mm)

 Functions and Methods


o Functions and methods allow doing operations on inputs, and can return data
after the operation is performed. Following are the syntax used for Functions &
Methods.
 Function

 Method

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

14
Best Practices

 Attributes
o Attributes represent all the information contained in a given Type (Name, Color,
and so on.). The syntax for access attributes of a given Type can be:

 Constants
o EKL recognizes some universally used constants like:
 PI, E: mathematical numerical constants
 PHI: golden ratio
 true, false: Boolean
 NULL: to test if a non-literal variable is set or unset

4. About EKL Editors

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


4.1. EKL Editor Interface
The EKL Editor can be divided into 3 main sections as shown in the image below:

1. Under Argument list (Action feature only), the user can define all the required
arguments and their Types. These Arguments are used in the Action code.

Note: You can also create Actions with no arguments. When running the action, a
smart selection mechanism takes place to provide the right object depending on the
expected type (a node in a product structure tree may represent an occurrence, an
instance or a reference.)

2. Enter Action script in the text field.


3. Under Dictionary, the user can check different methods and arguments available for
features and their functions.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

15
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


4.2. Knowledge Editor Toolbar
To understand the Knowledge Editor Toolbar options explained below, follow the sequence
of number tags on the following image:

1. Preferences: to set some editor preferences like syntax errors, text formatting,
snapshots, colors, and so on from the Expression Editor Preferences menu.
2. Line: Shows the cursor position
3. Find and replace: This function enables users to find & replace text
4. Language Browser: see section 4.3 for details.
5. Syntax errors: If the user has not activated the syntax error option from the
Expression Editor Preferences menu, then the Syntax errors option from the
toolbar allows to check the syntax errors. And, the line containing the errors is
highlighted.
6. URLs and Comment: allows user to associate a URL or comment to any Action.
7. Text field eraser: cleans up all the content in the text field (code field).
Note: before selecting this option, take a backup of the code.
8. Undo/Redo: allows to undo or redo the last operation.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

16
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


4.3. Language Browser
The Language browser is the main language tool used while programming. User can keep
the browser open while scripting. Follow the sequence of number tags on the following
image to understand the Language Bowser options explained below:

1. Type: represents the object’s PLM type the user is working on.
2. User can chose a Type from the drop down list shown below or select it from the
specification tree.
3. Supported/Inherited Types List: shows the inheritance structure.
4. Attributes: shows all attributes of the selected Type and the inherited types.
5. Functions Using Type: lists all functions using Similar Type/Inherited Type as one
of its argument.
6. Search: Allows to search functions that contain the search string.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

17
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

18
Best Practices

5. How to create an Action


An Action lets you perform interactively what the EKL language enables you to do. An Action
is created keeping in mind that the user would like to perform on-demand tasks, unlike the
Business Rules where tasks are performed based on events (Save, Duplicate, and so on.) A
Template Designer Role (KDI) is required for creating an Action. In the following example,
the “My First EKL” Action was created just to answer the most common question “Where do I
start from?”

Follow the sequence of numbers tags on the images below to perform the steps for creating
an Action:

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

19
Best Practices

6. Using Actions with Catalogs

6.1. Inserting an Action in a Catalog


Using Catalogs, user can run Actions on any context.

To insert an Action in a Catalog:

1. Create a new Catalog object.


2. Add a new Chapter by right-clicking on the chapter and selecting Insert  New
Chapter.
3. Name the Chapter as “EKL”.
4. Right-click on the Chapter and select Insert  Item: Feature
5. It will notify to select a feature from other tabs.
6. Select KW Action from the specification tree.
7. The selected KW Action is now part of the Catalog Chapter and ready for use.

To understand this process, you can also follow the sequence of number tags on the

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


following image:

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

20
Best Practices

6.2. Reusing an Action from a Catalog


Perform the following steps to use an Action that is already stored in a Catalog. Follow the
numbers tags on the images below to understand the process.

1. From the Tools section, select the Catalog Browser command.


2. Search for the Catalog containing the Action (one time action for a new Catalog).
3. The result is displayed.
4. Select the Catalog that was created in the previous Section 6.1 and expand the
Catalog to see the Action(s).
5. Right-click on the KW Action and click Use Item  Use Item.
6. The Insert Object dialog box appears for the selected Action, select the appropriate
inputs, and click OK.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

21
Best Practices

7. Working with Knowledge Resources


Knowledge Resources are objects that can be called from Knowledgeware features like
Rules, Checks, Actions, and so on. A Resource can be a Product Reference, a Catalog, a
PowerCopy/User Defined Feature, an Excel sheet, and so on.

There are two ways to define a Knowledge Resource:

 Locally using a Resource Table: Follow the number tags on the following images to
understand the process for creating a local knowledge resource.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


 Globally using the Data Setup App (for specific Collaborative Spaces): Similarly, follow
the number tags on the images below to understand the process for creating a global
knowledge resource.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

22
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


8. Message Functions used in EKL
The following sections explain different types of message functions.

8.1. Message and Popup Message


There are two types of messages: Message and Popup Message.

The difference between these two messages is as follows:

Message : All messages appear at the end of the script execution.

Popup Message : The script stops executing whenever it encounters a popup message.

let i = 1

Message("Hello World")

for i while i < 3

PopupMessage("i = #", i)

In the above script, Popup Messages appear at the time of script execution and the
Message appears at the end of the execution.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

23
Best Practices

8.2. Notify Message


This function enables users to display a yellow tooltip at the top right corner of the screen.

 To avoid tooltip overlap, the messages are stored within a defined timeframe and
displayed together when the application idles. The notifications are stacked until the
notifications stack reaches 40 elements.
 Notify is called using “|” as first character, which indicates that you want to start a
new notification stack.
 When the application idles, the different stacks are displayed as tooltips. Each tooltip
appears for a certain time which is computed using the size of the message with a
maximum of 60 seconds.
let i = 1
Notify("Hello World")
for i while i < 3
Notify("i = #", i)

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


8.3. Report Message
This function enables users to create an error displayed at the end of evaluation in an error
report. The report can either be a “Warning” or an “Error”.

Let oPrevPLMRef(PLMCoreReference)

Let oNextPLMRef(PLMCoreReference)

Let oPrevType(Type)

Let oNextType(Type)

Let strPrevType(String)

Let strNextType(String)

Set oPrevPLMRef = oPrevProdOcc.Reference

Set oNextPLMRef = oNextProdOcc.Reference

oPrevType = oPrevPLMRef.ModelerType

strPrevType = oPrevType.Name

oNextType = oNextPLMRef.ModelerType

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

24
Best Practices

strNextType = oNextType.Name

If strPrevType <> "DELLmiGeneralOperationReference" or strNextType <>


"DELLmiGeneralOperationReference"

Report("Error", "Both the Predecessor & Successor should of Operation Type to make the
relationship", "Please check the Predecessor & Successor Objects")

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


9. About Know-how Libraries
EKL is a procedural language where reusing code helps to avoid code duplication, and
enhances code readability and maintenance. You can define reusable functions in
the Know-how Capture app. These functions are defined in Know-how libraries objects.
Once defined and properly exposed through a local resource table or a Data Setup resource
set, user can include the libraries in any EKL script and call their functions like any other EKL
function.

A library can contain more than one function. Each function has a signature (its parameters)
and a body.

The library format supports:

 Definition of Multiple functions in a single library


 Definition of Methods or functions with optional arguments
 Default values on the optional arguments
 Description in HTML and plain text for each function

A reusable function can include other functions from the same or other libraries.

In the following example, follow the number tags on the images to understand the process
for creating a Know-how library and how to use this library.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

25
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

26
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

27
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


10. Debugging the EKL Issues

10.1. Using the EKL Debugger


The EKL debugger allows you to analyze and understand problems in your EKL code. To
open, select Debug from the contextual command.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

28
Best Practices

The debugger window appears as follows:

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


10.2. Capabilities of Debugger Window
Using the Debugger window, you can

 Set, remove, and disable breakpoints


• Jump from one break point to the next with a single play
• Step Over to pass from one line to another
• Step inside the functions to check the call-stack and debug the function
• Hover the mouse over variables to check the variable type and value
• Check all variables with their type and value using Scope

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

29
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


10.3. Debugging EKL Using Knowledge Monitor
You can use Knowledge Monitor to:

• Trace and analyze the execution of Knowledge applications (exit status, execution
times, I/O values, and for advanced users, stack traces, memory references and
memory footprints).
• Check attributes and parameters values as logged at execution.
• Trace the evolution of a given attribute throughout the entire execution, based on a
reference or on a name.
• Identify and Interact with logged entities in session.

10.3.1. Enable Knowledge Monitor


To enable the Knowledge Monitor:

1. Click the Knowledge Monitor Debug Command in the secondary area of the Tools
section before activating the entity to be traced.
2. Configuration Knowledge Monitor dialog box lists the available categories and their
activation flags:

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

30
Best Practices

Enabled: Indicates that the tracing is activated for the execution units belonging
to this category. In some cases though the user enables EKL expressions as
shown below, some expressions might still be hidden.
 Hidden: Indicates that tracing stops for the entire branch under the unit when
execution hits a hidden category. Tracing reactivates once an enabled unit is hit.
3. The Knowledge Monitor toolbar appears as shown in image 3 below. You can:
 Stop the Execution Traces (a)
 Open Knowledge Monitor (b)
 Add an object to the debug context (c )

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


10.4. Knowledge Monitor Window
The Knowledge Monitor Window consists of the following three sections. Follow the
sequence of number tags on the following image to understand the sections explained
below.

1. Time Line: shows the complete trace at debug. Execution units are displayed in
a tree-like structure under a root node which is a virtual node independent from the
execution units.
2. Unit Profile Area: Double-clicking a node in the timeline opens the Unit Profile Area.
The unit profile provides information regarding:
 Attributes that may be an input or output.
 Message containing additional information about the execution

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

31
Best Practices

Signature, shows the method/operator signature being executed. The signature is


identified by f(x).
 Body, the code being executed in the unit.
3. Versatile View:
 Display results of interactions with the execution unit profile (track changes or
references for example).
 Display the code for EKL expressions or Knowledge relations.
 Double-click the item in the profile to show the same text in the versatile view.
 Display results of text-based attribute search. Text-based searches help locate
attributes based on their names or parts of their names.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


10.5. Error Handling
You can enable or disable errors.

 Disable Errors: This function is used to deactivate all the script lines containing the
errors. Errors that occur in an EKL script after you called DisableErrors are stored in a
list.

 Enable Errors: This function is used to re-activate errors and retrieve the errors that
occurred after you called DisableErrors. It returns a list containing EvaluationError
objects corresponding to the errors raised by DisableErrors.

let resourceToFind(Feature)
let resourceName(String)
let listOfErrors(List)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

32
Best Practices

DisableErrors()
resourceToFind = AccessResource(resourceName, "Feature")
listOfErrors = EnableErrors()
if resourceToFind == NULL
{
Message("#", listOfErrors.Size())
}

11. Sample Scripts

11.1. Navigating Through Product Objects


Occurrence Model is used to navigate through the Product structure.

Following are the examples for navigating through product objects.

 Getting direct children of a Product


Let childrenList(List)
childrenList = oRootProductOcc.Children

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


Message("No of Children = ", childrenList.Size())
children method provides the direct children nodes

 Getting all the children Occurrence Objects for a given Object.


Let childrenList(List)
childrenList = oRootProduct->Query("ProductOccurrence", "")
Message("No of Children = ", childrenList.Size())
->Query("ProductOccurrence", "") method gets all the children for a given parent

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

33
Best Practices

 Query for children (or child) based on search condition.

Procedure: search for all product references that have the string “Crankshaft” in their
Title attribute.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


Let childrenList(List)

Let rootProduct(VPMReference)

Let strSearchStr(String)

Let strName(String)

Set rootProduct = GetEditorRoots("VPMReference“)->GetItem(1)

childrenList=rootproduct->Query("VPMInstance","x.Reference.V_Name like ‘*Crankshaft*’")

Message("No of Children = ", childrenList.Size())

Note: for all navigation purposes (Query, Find, and so on.):

 When working on variables of type Reference, user must use the


Reference/Instance types and their attributes.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

34
Best Practices

 When working on variables of type Occurrence, user must use the Occurrence
types and their attributes.

 Getting parent Occurrence and Reference of a given Occurrence.


Let oParentPrdOcc(ProductOccurrence)
Let oParentPrdRef(VPMReference)
Let oPrdOcc (VPMInstance)

Set oParentPrdOcc = oPrdOcc.Owner


Set oParentPrdRef = oParentPrdOcc.Reference
Message("Parent Reference name is: #”,oParentPrdRef.Name)

.Owner method gets the parent object (Occurrence Object)

.Reference gets the Reference object for a given Occurrence

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


Note:

 To go from Occurrence to Reference/Instance: use the .Reference/.Instance


attributes.
 To go from Reference/Instance to Occurrence: use the ListOccurrences method
(see next slide).

 Getting the number of occurrences of the reference in its context


ListOccurrences finds all the instances of the reference on which the method is called
in the context ref. The output is in the form of List.

In the following example, the requirement is to find out the number of occurrences of
the 3D Part “Part_1 (sprd00567542)”.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

35
Best Practices

Let I(list)
Let ref(VPMReference)
Let context(VPMReference)

Set ref= sprd00567542.1.Reference


Set contex=’Root_Product A.1’

if ref <>NULL and context <>NULL

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


l = ref- > • ListOccurrences(context)
Message (“Occurences of Part_1=”,I.Size())

Here, ListOccurrences(context) is used to find all occurrences of a reference


located in the given context. The output of the above Action is as follows:

 Getting an Occurrence Object for a given Reference Object


a. Search for “Part00007050” and get the Product Reference Object.
b. From the Reference Object, use .ListOccurrences(<Root Prd Item Ref>) to
get all the Occurrences.

The following script gives an Occurrence Object for a given Reference Object:

Let childrenList(List)
Let rootProduct(VPMReference)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

36
Best Practices

Let productRef(VPMReference)
Let productOcc(ProductOccurrence)
Let occList(List)
Let strSearchStr(String)
Let strName(String)

rootProduct = oRootOccurrence.Reference
strName = "Part00007050"
strSearchStr= "x.V_Name ==" + " \"" + strName + "\""
childrenList = rootProduct->Query(“VPMReference", strSearchStr)
If childrenList.Size() > 0
{
Set productRef= childrenList->GetItem(1)
occList = productRef->ListOccurrences(rootProduct)
If occList.Size() > 0
{
productOcc= occList->GetItem(1)
Message("Occurrence Name = ", productOccOcc.Name)
}

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


}

Here,

 ListOccurrences(rootProduct), will list all the Occurrences of a Reference


Object.
 rootProduct is any Reference containing occurrence(s) of the given
Reference
 Getting the number of instances of the reference in this context

ListInstances finds all the instances of the reference on which the method is called in
the context ref. The output is in the form of List.

In the following example, the requirement is to find out the number of instances of the
3D Part “Part_1 (sprd00567542)”.

Let I(list)
Let ref(VPMReference)
Let context(VPMReference)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

37
Best Practices

Set ref= sprd00567542.1.Reference


Set contex=’ Root_Product A.1’

if ref <>NULL and context <>NULL


l = ref- > • ListInstances(context)
Message (“Instance of Part_1=”,I.Size())

Here, ListInstances(context) finds all instances of a reference located in a given


context.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


11.2. Creating New Product Objects
Following are the examples for creating new product objects.

 Create a Reference object without a parent and instantiate it.


Let createdReference(VPMReference)
Let createdInstance(VPMInstance)
createdReference = new("VPMReference", "MyNewRef", NULL)
createdInstance=new("VPMInstance","MyNewInstance",ProdOcc.Reference,createdReferenc
e)
Message("Created object type is: #",createdReference.ModelerType.Name))

Here, .ModelerType.Name gives the name of the object type that is created.

 Create a Reference object with a parent. The result will be directly an Instance
object.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

38
Best Practices

Let createdNewInst(VPMInstance)
Let parentRef(VPMReference)
Set parentRef = parentOcc.Reference
Set createdNewInst= new(“VPMReference", “MyNewInst", parentRef)
Message("Created object type is: #",createdNewInst.ModelerType.Name)

 Check if the list of instances is updated.

UpdateListOccurrences: This function is required when you create product entities in


the script and want to retrieve the occurrence. The resultant update is not
synchronized so this function allows to force synchronization.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


let ref (VPMReference)
let inst, inst2 (VPMInstance)

inst = new("VPMReference", "MyNewRef", root)


if inst <> NULL
inst2 = new("VPMInstance", "Instance2", root, inst.Reference )

root.UpdateListOccurrences()

let l (List)
l = inst.Reference.ListOccurrences(root)
if (l.Size() <> 2)
Report("Error", "UpdateListOccurrences function failed",””)

11.3. Retrieving the Position Matrix of an Instance


The position matrix of an instance is an attribute of the instance. Following are the examples
for retrieving position matrix.

 Retrieve position matrix of an instance.

It is very simple to retrieve the position matrix. But, you will get only the position
matrix of an instance in the context of its father. Refer to the following script:

let inst (VPMInstance)


let str (string)
let mt (matrix)
//To be able to retrieve the position matrix of an instance use the PositionMatrix attribute.
// this will give you the position matrix in the context of the father of the instance
mt=inst.PositionMatrix

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

39
Best Practices

//translation vector is the 4th column


str="("+ToString(mt->Get(1,4))+","+ToString(mt->Get(2,4))+","+ToString(mt->Get(3,4))+")"
Message("In product context:Translation Vector is the 4th column = ", str)

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


 Position matrix of an instance in the root context.
let root,ref (VPMReference)
let str (string)
let lstocc (list)
let occ (ProductOccurrence)
let mt (matrix)
let inst (VPMInstance)

// To be able to retrieve the position matrix in root context we must retrieve the occurrence of
the ref
root=GetEditorRoots("VPMReference").GetItem(1)
ref=inst.Reference
lstocc=ref->ListOccurrences(root)
occ=lstocc.GetItem(1)

// the objects ProductOccurrence don’t have the PositionMatrix attribute


// so we must cast the occ to an instance to be able to get a PositionMatrix attribute
set inst=occ
mt=inst.PositionMatrix

//translation vector is the 4th column


str="("+ToString(mt->Get(1,4))+","+ToString(mt->Get(2,4))+","+ToString(mt->Get(3,4))+")"
Message("In root context: Translation Vector is the 4th column = ", str)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

40
Best Practices

11.4. Working with External Files

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


The following examples illustrate working with different types of external files.

 Working with Excel/CSV files


Let strFileName(String)
Let oXLSheet(DTSheetType)
Let indx(Integer)
Let noOfRows(Integer)
Let strColorName(String)
Let rValue(Real)
Let gValue(Real)
Let bValue(Real)
Let strRowValue(String)

strFileName = "E:\\Temp\\Test Input.xlsx"


Set oXLSheet = CreateSheet(strFileName)
noOfRows = oXLSheet.RowsNb

indx = 1
For indx while indx < noOfRows
{
strColorName = oXLSheet.CellAsString(indx, 1)
rValue = oXLSheet.CellAsReal(indx, 2)
gValue = oXLSheet.CellAsReal(indx, 3)
bValue = oXLSheet.CellAsReal(indx, 4)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

41
Best Practices

Note:

 When reading Excel or CSV files, consider making Row 1 as the header row with
non blank values in the columns.
 If any of the column in the first row is empty, EKL considers all the rows of the
column as empty.
 CreateSheet is used for reading and writing into Excel. Its argument can be a
disk file path, a Data Setup path, or a logical name of the local Resource Table.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


To read/write in a specific sheet, specify the sheet number with the syntax:
CreateSheet([strFileName]SheetNumber).
 To Write to Excel simply use: oXLSheet.CellAsString(indx, 1) = strColorName

 Working with Text files


o To Write to Text files
Let file (TextFile)
Let buffer (String)

Set file = OpenTextFile("e:\tmp\TextFile1.txt","w")


buffer = "Hello"
file->Write(buffer)
file->Close()

o To Read from Text files


Let file (TextFile)
Let buffer (String)

Set file = OpenTextFile("e:\tmp\TextFile1.txt","r")


Set buffer = file->Read()
file->Close()

Note:

 In the above syntax, the three different modes are:


“w” to write in the file and to create a txt file if it does not exist.
“a” to add text at the end of the file.
“r” to read the file.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

42
Best Practices

 This syntax works only for disk files (not for database documents).

 Working with XML files


o Reading XML files
Let xmlReferenceDoc(XMLDocument)
Let oRootXMLNode(XMLNode)
Let childrenNodeList(List)
Let oChildXMLNode(XMLNode)
Let strNodeName(String)
Let listOfWBSNodes(List)
Let intWBSCnt(Integer)
Let xmlWBSNode(XMLElement)
Let xmlWBSNodeName(XMLNode)
Let oTextNode(XMLText)
Let strWBSName(String)
xmlReferenceDoc = CreateXMLDocument("E:\Temp\PrimaveraProject.xml")

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


oRootXMLNode = xmlReferenceDoc.Root
childrenNodeList = oRootXMLNode.Children
oChildXMLNode = oRootXMLNode->Access("APIBusinessObjects\Project",
"XMLElement")

/* Find All the Nodes of the Type WBS */


strNodeName = "x.Name == \"WBS\""
childrenNodeList = oChildXMLNode.Children
listOfWBSNodes = childrenNodeList->Filter("XMLElement",strNodeName)
intWBSCnt = listOfWBSNodes.Size()

If intWBSCnt > 0
{
/* Using the result get each of the WBS Node's Text */
For xmlWBSNode inside listOfWBSNodes
{
xmlWBSNodeName = xmlWBSNode->Access("Name", "XMLNode")
oTextNode = xmlWBSNodeName.Children->GetItem(1)
strWBSName= oTextNode.Text
}
}

o Writing XML files


Let xmlDoc(XMLDocument)
Let xmlCurrentNode, xmlTopNode, xmlRootNode(XMLNode)
Let listOfProdSysOcc(List)
Let oProdSysOcc, oParentProdSysOcc(ProdSystemOccurrence)
Let oPLMRef, oParentRef(PLMCoreReference)
Let strID, strParentID(String)
Let j(Integer)

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

43
Best Practices

xmlDoc = new("XMLDocument","System Structure",NULL)


xmlDoc.FilePath = "E:\\Temp\\ExportSystemStructure.xml"
xmlRootNode = xmlDoc.Root

listOfProdSysOcc = oRootProdSysOcc->Query("ProdSystemOccurrence", "")


Set oPLMRef = oRootProdSysOcc.Reference
strID = oPLMRef.PLM_ExternalID

xmlTopNode = new("XMLElement", "SYSTEMSTRUCTURE", xmlRootNode)


xmlCurrentNode = new("XMLElement", "OBJECT", xmlTopNode)
xmlCurrentNode->SetAttributeString("ID",strID)
xmlCurrentNode->SetAttributeString("Parent","")
j=1
for j while j <= listOfProdSysOcc.Size()
{
oProdSysOcc = listOfProdSysOcc->GetItem(j)
Set oPLMRef = oProdSysOcc.Reference
strID = oPLMRef.PLM_ExternalID
Set oParentProdSysOcc = oProdSysOcc.Owner

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


Set oParentRef = oParentProdSysOcc.Reference
strParentID= oParentRef.PLM_ExternalID
xmlCurrentNode = new("XMLElement", "OBJECT", xmlTopNode)
new("XMLText",oPLMRef.V_Name, xmlCurrentNode)
xmlCurrentNode->SetAttributeString("ID",strID)
xmlCurrentNode->SetAttributeString("Parent",strParentID)
}
xmlDoc.Save()

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

44
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


 Colouring Features Based on Layer Property
o The correspondence between the Layer number and a RGB color code is
specified in an Excel sheet that is used as a Knowledge Resource in the Data
Setup.
o The following Action script reads the Layer property of each feature (Solid or
Wireframe/Surface) and sets the color based on what is specified in the Excel
sheet.
Let myfeaturesList,geomsetsList,mysolidfeaturesList,bodiesList (List)
let mylayer, indx (Integer)
Let myfeature,mysolidfeature (Visualizable)
Let mygeomset(OpenBodyFeature)
Let mybody(bodyfeature)
let R, G, B (Real)
Let oXLSheet(DTSheetType)

Set oXLSheet=CreateSheet("KnowledgeResources|Layers_code")

//Loop on all features of all Solid Bodies


set bodiesList=`3D Shape00188329 A.1`->Query("BodyFeature","")

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

45
Best Practices

For mybody inside bodiesList


{

set mysolidfeaturesList=mybody.Children
for mysolidfeature inside mysolidfeaturesList
{

mylayer=mysolidfeature.Layer

indx=oXLSheet.LocateInColumn(1,mylayer)
R = oXLSheet.CellAsReal(indx, 3)
G = oXLSheet.CellAsReal(indx, 4)
B = oXLSheet.CellAsReal(indx, 5)
mysolidfeature.Color = ToString(R) + "," + ToString(G) + "," + ToString(B)

}
}

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


//Loop on all features of all Geometrical Sets
set geomsetsList=`3D Shape00188329 A.1`->Query("OpenBodyFeature","")

For mygeomset inside geomsetsList


{

set myfeaturesList=mygeomset.Children
for myfeature inside myfeaturesList
{

mylayer=myfeature.Layer

indx=oXLSheet.LocateInColumn(1,mylayer)
R = oXLSheet.CellAsReal(indx, 3)
G = oXLSheet.CellAsReal(indx, 4)
B = oXLSheet.CellAsReal(indx, 5)
myfeature.Color = ToString(R) + "," + ToString(G) + "," + ToString(B)

}
}

Message ("Coloring sucessfully done")

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

46
Best Practices

12. About Getting Started


When you click on the Getting Started icon shown below (highlighted in red box), a brief
explanation about the EKL Language is displayed in the Getting Started dialog box with a few

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


examples that the user can test.

Getting Started allows a user with no experience in EKL to be able to do basic scripts more
easily.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

47
Best Practices

Note: Clicking once on the Getting Started icon opens a new Getting Started dialog box.
Clicking on this icon while the Getting Started dialog box is already open will close the existing
Getting Started dialog box.

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


The content of Getting Started will vary based on the type of EKL Script that is being used:
Action, Rule, Check, and so on. The getting started content in the above image is for the
Action.

The Getting Started contains a Table of content that lists different topics. The user can visit
any of these topics to get information on any particular subject. Samples are available for each
topic as shown in the image below. The user can come back to the Table of content by clicking
on the “Table of content” button.

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

48
Best Practices

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020


On the right side of the sample script, there is an option, “Try it”. On clicking this option, it will
copy the content of the Sample inside the current EKL Script Editor as shown below:

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

49
Best Practices

13. References
 3D Modeling > Multi Discipline Automated Engineering > Know-how Apps
Authoring Suite > Know-how Apps Logic > Creating a Library
 3D Modeling > Multi Discipline Automated Engineering > 3D Templates Capture
> Reference Information > Design Table Functions
 3D Modeling > Multi Discipline Automated Engineering > Know-how Apps
Authoring Suite > Know-how Apps Components > Working With Configured
Resources

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

50
Best Practices

14. Document History


Document Revised By Changes/Notes
Date
Revision
1.0 08/07/2020 PATOLE Onkar Original

© Dassault Systèmes | Confidential Information | ref.: 3DS_Document_2020

Confidential information. Copyright Dassault Systèmes [2020].


This document is provided for information purpose only and may be used by authorized users only for their own internal use. Any other use
without prior written authorization from Dassault Systèmes is strictly prohibited, except as may be permitted by law.

51

You might also like