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 simplerIntroduction
This document intended to provide a detailed guide and examples on how to write EKL script to detach Configuration Context (Model dictionary) on Mfg. Item.
Version – 2021x FD09 (FP2140), 2022x FD08 (FP2319), 2023x FD04 (FP2333),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 detach Model Dictionary on Mfg. Item are the following.
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 detach 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 detached.
requestURI=requestURI+strPhysicalID
requestURI = requestURI + "/dscfg:Configured/detach"
// 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\\":\\""+strModDictPID+"\\",\\"type\\":\\"dsmfg:MfgItem\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strPhysicalID+"\\"}]"
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 detached successfully on selected Object")
else
PopupMessage("Model dictionary failed to detach on selected Object.")
}Get Physical ID of attached Model Dictionary
To detach model dictionary we check if Model is attached on selected Mfg. item, to get Model attached call EKL action Get Model Dictionary on Mfg. Item attached in above example.
Below is the code for reference,
// Get Physical ID of Mfg Item Reference
Let strPhysicalID(String)
strPhysicalID = (selMfgItemOcc.Reference).GetPhysicalId()Get Physical ID of selected Mfg. Item
To get / attach / detach model dictionary it needs physical ID of Object to which Model dictionary is attached. Below is the code which gets physical ID of Mfg. Item.
// Get Physical ID of Mfg Item Reference
Let strPhysicalID(String)
strPhysicalID = (selMfgItemOcc.Reference).GetPhysicalId()JSON request body
Detach 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\\":\\""+strModDictPID+"\\",\\"type\\":\\"dsmfg:MfgItem\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strPhysicalID+"\\"}]"Here under some Use Case about possible adaptation of the script
1. Requirement 1: Detach model dictionary on other type of objects in structure
In above example we saw detailed explanation of how the script is written to detach the Model dictionary of Mfg Item, there might be requirement where we need to detach 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 detach Model dictionary we will set its type.
| Mfg Item | Eng Item | System | Resource |
|---|---|---|---|
| MfgProcessOccurrence | ProductOccurrence | ProdSystemOccurrence | ResourceOccurrence |
- Get Attached Model Dictionary
In our case we get Model Dictionary from Mfg. Item by calling EKL Action Get Model Dictionary On Mfg. Item, similarly to get Model Dictionary on other type of objects respective Get Model Dictionary script has to be called.
Below tables lists down object types 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 detach 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.
Web service call 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/detach"Web service call for System:
// 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/detach"- Modify JSON request body as per corpus type
In our case we used dsmfg/dsmfg:MfgItem for Mfg. Item to detach model on other type like system object then modify JSON as shown below,
//For Mfg Item
strJSONLoad = "[{\\"identifier\\":\\""+strModDictPID+"\\",\\"type\\":\\"dsmfg:MfgItem\\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strPhysicalID+"\\"}]"
//For System
strJSONLoad = "[{\\"identifier\\":\\""+strModDictPID+"\\",\\"type\\":\\" dsprcs:MfgProcess \\",\\"source\\":\\"3DSpace\\",\\"relativePath\\":\\"/resources/v1/modeler/ dsprcs/dsprcs:MfgProcess /"+strPhysicalID+"\\"}]"How to Deploy
Get_Physical_Id Script is not needed now
Author
Author: @RR
For any queries, please reach out to: @KA
