What's new in updated script in 2024?
1. The script now supports creation of all types of OOTB Systems and operations For example: Header Workplan, Workplan, General System, Quality Control Process, Loading Operation, Point Fastening Operation etc.
2. Instead of creating "Time Constraint" between Operations, "Material Flow" gets created between them.
3. Improvements are done in the algorithm of the script.
Introduction
This document intended to provide a detailed guide and examples on how to write EKL script to import System Structure from Excel
Version – Validated on 2021x FD09 (FP2140), 2022x FD01 (FP2205), 2023x FD02 (FP2314), 2024x FD02 (FP2414), 2025x FD03 (FD2524)
Pre-requisites:
Licenses –
- CSV(Collaborative Industry Innovator)
- MDG(Mechanical Designer)
- PPL(Process Engineer)
- KDI(Template Designer)
Disclaimer: Licenses mentioned above are as per 2021x, 2022x, 2023x, 2024x & 2025X documentation.
Logical Flow
Below is the logical flow for Import System Structure EKL script:
Example
Detail Explanation
Excel template for Importing Resource Structure
The template excel format is as shows below:
The 1st 7 columns are reserved and necessary to be added. Their description is as given below:
Column Title | Significance |
Level | Defines level of object inside structure, 1 – Root 2 – First level child of root or child of level 1. 3 – Second level child of root or child of level 2. … N – Child of level N – 1. |
Type | Type of object to create
|
Title | V_Name of Object created |
Inst_Name | V_Name / PLM_ExternalID of Object Instance created |
Precedence_Link | Precedence link created between operations instance and material flow for system instance Can give multiple “;” separated instance names. |
MID_Link | MfgItem instance name to link with created Operation. Can give multiple “;” separated instance names. |
Resource_Link | Resource instance name to link with created Operation. Can give multiple “;” separated instance names. |
Additional attributes | All other attributes (Internal name) to be set on created Object’s reference and instance. |
Note: If instance attributes value needs to be set then add “Inst_” keyword before attribute name. For example for instance description, it will be “Inst_V_description”
How to manage Multi-Instantiation
Steps followed for managing Multi-Instantiation:
In the script, every time an new object is created, its reference is added in dictionary (Volatile instance) with V_Name(strPartNo) used as its key. This is useful for multi-instantiation.
- Check if the reference with V_Name (strPartNo) of item to be created is already available in Dictionary of existing objects.
- If the reference is not created previously, create a new reference and add it Dictionary of existing object. Create its instance with specified instance name. Set attributes of new objects reference and instance.
- If the reference with V_Name of item to be created is available in dictionary, extract it and create its new instance. Set the attributes of newly instantiated object.
In the attached EKL Script, code between below comments is responsible to support multi-instantiation
/*---------------------------------------Section to support multi-instantiation -------------------*/
.
.
/*---------------------------------------End of Section to support multi-instantiation ------------*/
How to set additional attribute and other custom attributes:
To set other extra attributes of the created objects, add extra columns in the excel file after column 7. 1st 7 columns are reserved for Level, Object type, Title(Reference Name), Instance name, Precedence link, MID Link and Resource link. While creating the column, column name should be the attribute name. Add the values in respective rows. While setting the column name for attribute of instance object, add “Inst_” as a prefix in the column name.
The EKL script manages to set the additional attributes if they are specified in the excel file. The condition is, the attribute should be available on the object. User can specify custom attributes also if available.
For example: Additional attributes to be set are highlighted in red box.
The code between below comment lines in attached EKL script is responsible for setting additional and custom attributes. It set both reference and instance object attributes.
//Logic to read remaining columns and set additional attributes
.
.
//End of for loop to set Additional Attributes
Creation of Implement Link or Resource Link:
The explanation for creating implement link/Resource is given below.
- For each MID/Resource object to be linked, run a Query on Root MID/Root resource to search item with Instance Name same as the item name specified in excel.
- Get the Mfg Item/Resource item with specified Instance name and assign it to the System object.
If the user wants to modify the logic for creation of Implement Link, modify section of code between comments given below
//-----START Mfg Item Implement link-----
.
.
//-----End Mfg Item Implement link-----
If the user wants to modify the logic for creation of Resource Link, modify section of code between comments given below
//-----START Resources Implement Link-----
.
.
//-----END Resources Implement Link-----
Creation of Precedence Link:
Precedence Link is created at the end after creating whole System Structure. A query is executed on Root System to get the Occurrence of System object to be linked. If both the objects are of type, General System, Material Flow is created. If both the objects are of Operation type, Time Constraint is created.
To modify the logic for precedence link, modify the code between below comments.
//-----START precedence link-----
.
.
//-----END precedence link-----
Here under some Use Case about possible adaptation of the script
1. Requirement 1: Support CSV input file type.
To support .csv file type instead of .xlsx, follow bellow steps:
- Edit below string in the VBScript:
In the script, strFileName string specifies the input excel file type. Modify the extension of the file name to .csv
'For .xlsx
strFileName = CATIA.FileSelectionBox("Select the input Excel File", "*.xlsx", CatFileSelectionModeOpen)
'For .csv
strFileName = CATIA.FileSelectionBox("Select the input Excel File", "*.csv", CatFileSelectionModeOpen)
- In the EKL script, make following changes:
In the EKL script, strTempFileName variable of string type specifies the type of excel file to be created. Modify the below lines of code
//For .xlsx
strTempFileName = "SystemStructure_" + strTemp3 + ".xlsx"
//For .csv
strTempFileName = "SystemStructure_" + strTemp3 + ".csv"
2. Requirement 2: Use Display Name as Object Type instead of Internal ObjectType
If the user wants to use Display Name as Type of the object instead of Internal Object type, add below lines of code after reading the attributes from the excel. Eg. If user want to specifi “General System” instead of “DELLmiGeneralSystemReference”.
/* This section is to read object type from column "Type" */
If strObjType == "General System"
strObjType = "DELLmiGeneralSystemReference"
else if strObjType == "Workplan System"
strObjType = "DELLmiWorkPlanlSystemReference"
else If strObjType == "Loading Operation"
strObjType = "DELLmiLoadingOperationReference"
else If strObjType == "General Operation"
strObjType = "DELLmiGeneralOperationReference"
// Specialized data type
else if strObjType =="DMDDE1CustoGenOpr"
strObjType = "DMDDE1CustoGenOpr"
else
PopupMessage("INVALID Type: given type is not supported please modify script to support it")
/* similarly add if statements for custome object types */
3. Requirement 3: Use custom column names instead of internal attribute name
If the user wants to use custom column names instead of internal attribute name, for example:
Here “description” is used instead of “V_description”
Add below line of code in the EKL script, where additional/custom attribute values are read from the excel file.
if strAttrName== " description "
{
strAttrName = "V_ description”
}
else if strAttrName == "Instance description"
{
strAttrName = "Inst_V_description"
}
How to Deploy
This video describes: How to deploy the "Import Product Structure from Excel?" EKL Script. However, the process is same for following EKL Scripts:
1. Import Resource Structure from Excel
2. Import Mfg. Item Structure from Excel
3. Import System Structure from Excel
(Note:
1. Instead of creating a separate Physical Product for containing each script, you can create the action files for the above three EKL scripts in the same Physical Product that we are going to create for "Import Product Structure from Excel" EKL Script.
2. The Excel File Selector VBScript is same for all the above EKL Scripts. So, you can create it only once and use it in all the above EKL Scripts.
3. The input arguments are different for different type of structure script. The information is provided in the respective EKL script as a comment at the top section.
)
References link
<
Author
Authors: @KA @RR @YB
For any queries, please contact - @KA