Introduction
Whats new in 2025?
The scripts now use the "GetPhysicalId" method to get the Physical ID of the objects instead of using web services. This makes the overall script simpler.Introduction
This document intended to provide a detailed guide and examples on how to write EKL script to attach Configuration Context (Model dictionary) & criteria on Mfg. Item.
Along with this there are example EKL actions to attach Configuration Context & criteria on Engineering Item, Resource and System.
Version – 2023x FD04 (FP2333), 2024x FD04 FP.CFA.3432, 2025x FD02 FP.CFA.2514, 2026x GA
The method "GetPhysicalId" is available from 2023x onwards. For EKL scripts suitable for older versions of 3DEXPERIENCE (2021x and 2022x), please check the "Revision 0" of this Wiki page from the "Show History" menu
Pre-requisites
Licenses –These EKL scripts call 3DSpace web services, which require specific licenses to execute as mentioned in below table. (These are referred from developer documentation of web services)
Engineering Item related web services
• XEN (Product Release Engineer) For dseng:EnterpriseReference(Authoring) Web Services
• XEN (Product Release Engineer) or PAU (3D Product Architect), For dseng:EngItem (Authoring) and dseng:EngInstance (Authoring) Web Services
• CSV (Industry Innovation), For Reading Web Services
Mfg Item related web services
• MFN (DELMIA Manufactured Items Management)
• CSV (Industry Innovation) For Reading Web Services
Mfg Process / System related web services
• MGA (DELMIA Process Management)
• CSV (Industry Innovation) For Reading Web Services
Resource related web services
• MGA (DELMIA Process Management)
• FAM (DELMIA Factory Asset Management)
• CSV (Industry Innovation) For Reading Web Services
Model dictionary or portfolio related web services
• PDM (Product Manager), For Authoring Web Services
• CSV (Collaborative Industry Innovator), For Reading Web Services
Model configuration, effectivity or IP Configuration related web services
• CFG (Configuration Management), For all dscfg web services
• CSV (Industry Innovation), For Reading Web Services
Disclaimer: Licenses mentioned above are as per 2021x, 2022x and 2023x documentation.
Logical Flow
The sequence of the scripts / steps to attach Model Dictionary & Criteria on Mfg. Item are the following. The scripts for System, Engg. Item and Resources works in the similar way.
Example
Disclaimer: This code is just an example and should only be used by people who know the Enterprise Knowledge Language (EKL) and the DELMIA data model very well. The intent is not to provide a ready to deploy product code. So we are not responsible for any issues you may face with this code.
Detail Explanation
How to call web services
Steps followed for calling all web services.
- Create HTTP client.
- Define header for the HTTP client.
- Build web service URI.
- Perform GET/POST request.
- Retrieve the returned response code if it is zero / as per documentation then ok else error case.
- To retrieve the required content from the response traverse through returned data node or buffer.
For example – Below script calls web service to attach Model dictionary on Mfg Item.
// 1. Create content for Header
let oDTN (DataTreeNode)
let oBuffer(String)
let headers(List)
headers.RemoveAll()
headers.Append("Content-Type: application/json")
headers.Append("Accept: application/json")
headers.Append("SecurityContext: " + "ctx::" + GetSystemInfo("securitycontext"))
// 2. Get CSRF token
let strCSRFToken(String)
let actionCSRFToken(AdvisorAction)
set actionCSRFToken = AccessResource("Get_CSRF_Token","AdvisorAction")
//`Knowledge Engineering Specification Physical00000084 A.1\\Relations\\Get CSRF Token V1.0`
actionCSRFToken.Run(strCSRFToken)
headers.Append("ENO_CSRF_TOKEN:"+strCSRFToken)
// 3. Create web service method URI
let requestURI="/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"
// strPhysicalID - PID on which dictionary to be attached.
requestURI=requestURI+strPhysicalID
requestURI = requestURI + "/dscfg:Configured/attach"
// 4. Perform POST request
Let httpReqAction(AdvisorAction)
Let strJSONLoad, strOBuffer(String)
Let bIsReqSuccessful(Boolean)
if (iStrModelPhysicalID <> "")
{
// 5. Create JSON load to pass to POST method
strJSONLoad = "[{\\"identifier\\":\\""+iStrModelPhysicalID+"\\",\\"type\\":\\"dsmfg:MfgItem\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strPhysicalID+"\\"}]"
PopupMessage("StrJSONLoad - "+strJSONLoad)
set httpReqAction = AccessResource("HTTP_Request","AdvisorAction")
//`Knowledge Engineering Specification Physical00000084 A.1\\Relations\\HTTP Request V1.0`
httpReqAction.Run("POST", requestURI, headers, strOBuffer, oDTN, bIsReqSuccessful, strJSONLoad)
if (bIsReqSuccessful == TRUE And oDTN <> NULL)
PopupMessage("Model dictionary attached successfully on selected Object")
else
PopupMessage("Model dictionary failed to attach on selected Object.")
}Add Criteria to the Model
After attaching the Model Dictionary to an object, configuration criteria can be enabled using the /dscfg:Configured service.
The criteria must be provided as a valid JSON array (for example: ["Variant","ModelVersion"]).
The action sends a PATCH request with the enabledCriteria payload to apply the configuration dimensions.
On failure, the backend returns a 400 error with details in the response message.
Examples of Valid iStrCriteria Values:
1. ["Variant"]
2. ["Variant","ModelVersion"]
3. ["Variant","Unit","ContextualDate","ManufacturingPlan"]
4. ["Variant","ModelVersion","Unit"]
if (iStrCriteria <> "" And iStrCriteria <> NULL)
{
// Validate array format
if (iStrCriteria.Search("[") < 0 Or
iStrCriteria.Search("]") < 0)
{
PopupMessage("Invalid Criteria Format. Expected JSON Array.")
}
else{
requestURI = "/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"
requestURI = requestURI + strPhysicalID + "/dscfg:Configured"
strJSONLoad = "{\\"enabledCriteria\\":" + iStrCriteria + "}"
httpReqAction.Run("PATCH", requestURI, headers,
strOBuffer, oDTN,
bIsReqSuccessful, strJSONLoad)
if (bIsReqSuccessful == TRUE)
{
PopupMessage("Configuration Context and Criteria attached successfully.")
}
else
{
PopupMessage("Criteria attachment failed.\\nResponse:\\n" + strOBuffer)
}
}Get Physical ID of selected Mfg. Item
To get / attach / detach model dictionary it needs physical ID of Object to which Model dictionary needs to be attached. Below is the code which gets physical ID of Mfg. Item.
Get Physical ID of selected Mfg. Item by calling the "GetPhysicalId()" method.
Before 2023x, it is required to use "Search" web services to get the Physical ID of the objects as done in previous version of the script. (Please check the scripts provided in the "Version 0" of this WiKi page.
// strPhysicalID - PID of object on which dictionary to be attached. strPhysicalID = selMfgITemRef->GetPhysicalId() //Get Physical ID of the Mfg. Item to attch the configuration contextAttach model dictionary method uses POST method where request body in JSON format is to be sent with POST request, so below is the code that builds this JSON body.
strJSONLoad = "[{\\"identifier\\":\\""+iStrModelPhysicalID+"\\",\\"type\\":\\"dsmfg:MfgItem\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strPhysicalID+"\\"}]"iStrModelPhysicalID: it is the Physical ID of the model that needs to be attached on the Mfg. Item
How to get Model Physical ID?
To get the Physical ID of the Model, one can use the MQL command given below:
temp query bus Model ModelName/PLMExternalID * select physicalid;Note: Replace the underlined part of the command with your model name/PLMExternal ID
For example:
temp query bus Model MV-42300495-00000007 * select physicalid;Here under some Use Case about possible adaptation of the script
1. Requirement 1: Attach model dictionary on other type of objects in structure
In above example we saw detailed explanation of how the script is written to attach the Model dictionary of Mfg Item, there might be requirement where we need to attach Model dictionary on Eng Item, System or Resource objects. In this case, user need to modify above script and reuse them.
Below are some of the changes required in the script to use it for Eng Item, System or Resources.
- Object selection
Based on to which type of object we want to attach Model dictionary we will set its type.
| Mfg Item | Eng Item | System | Resource |
|---|---|---|---|
| MfgProcessOccurrence | ProductOccurrence | ProdSystemOccurrence | ResourceOccurrence |
- Modify script to get physical ID of other type of object
In our example we used dsmfg/dsmfg:MfgItem, instead of that if attach Model dictionary is to be done on System object then modify the corpus type as mentioned in below table. For example,
Get Physical ID For Mfg Item:
set actionGetPhysicalID = AccessResource("Get_Physical_ID","AdvisorAction")
actionGetPhysicalID.Run(selMfgItemOcc.Reference, "dsmfg/dsmfg:MfgItem", strPhysicalID, oPhyIDRespStatus)Get Physical ID for System
set actionGetPhysicalID = AccessResource("Get_Physical_ID","AdvisorAction")
actionGetPhysicalID.Run(selMfgSysOcc.Reference, "dsprcs/dsprcs:MfgProcess", strPhysicalID, oPhyIDRespStatus)Below table shows different objects and its respective corpus types:
| Mfg Item | Eng Item | System | Resource |
|---|---|---|---|
| dsmfg/dsmfg:MfgItem | dseng/dseng:EngItem | dsprcs/dsprcs:MfgProcess | dsrsc/dsrsc:Resource |
| dsmfg:MfgItemInstance | dseng:EngInstance | dsprcs:MfgProcessInstance | dsrsc:ResourceInstance |
| dsprcs:MfgOperation | |||
| dsprcs:MfgOperationInstance |
- Modify web service URI to attach Model dictionary to respective corpus type
In our case we used dsmfg/dsmfg:MfgItem for Mfg Item, similarly for System object it needs to be modified as dsprcs/dsprcs:MfgProcess, below is the code for reference.
Code For Mfg. Item:
// Define URI parameters for Mfg Item
let requestURI(String)
requestURI="/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"
// strPhysicalID - PID on which dictionary to be attached.
requestURI=requestURI+strPhysicalID
requestURI = requestURI + "/dscfg:Configured/attach"Code for Systems:
// Define URI parameters for System
let requestURI(String)
requestURI="/resources/v1/modeler/dsprcs/dsprcs:MfgProcess/"
// strPhysicalID - PID on which dictionary to be attached.
requestURI=requestURI+strPhysicalID
requestURI = requestURI + "/dscfg:Configured/attach"
- Modify JSON request body as per corpus type
In our case we used dsmfg/dsmfg:MfgItem for Mfg Item to attach model on other type like system object then modify JSON as shown below,
For Mfg Item:
strJSONLoad = "[{\\"identifier\\":\\""+iStrModelPhysicalID+"\\",\\"type\\":\\"dsmfg:MfgItem\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strPhysicalID+"\\"}]"For System:
strJSONLoad = "[{\\"identifier\\":\\""+iStrModelPhysicalID+"\\",\\"type\\":\\"dsprcs:MfgProcess\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsprcs/dsprcs:MfgProcess/"+strPhysicalID+"\\"}]"Note: The ready to use scripts for Systems, Engg. Item and Resources are provided in this WiKi page. So, it is not needed to create them from scratch
How to Deploy the Scripts
The video given below is just a example to show: "how to deploy the above provided EKL scripts?". It may not be as per the best industrial practices.
Author
Author - @RR
For any queries, please contact - @KA
