Get Configuration Context & Criteria on Mfg. Item, System, Engg. Item and Resources

Introduction

This document intended to provide a detailed guide and examples on how to write EKL script to get the Configuration Context (Model dictionary) and Criteria on Mfg. Item.

Along with this there are example EKL actions to get Configuration Context (Model dictionary) & Criteria on Engineering Item, Resource and System. These scripts works similar to the script for Mfg. Item.

Version – 2021x FD09 (FP2140), 2022x FD08 (FP2319), 2023x FD04 (FP2333), 2026x GA

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 Get Model Dictionary & criteria on Mfg. Item are as given below:

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.

 

HTTP_Request
Get_Attached_Configuration_Context_and_criteria_on_Mfg_Item
Get_Attached_Configuration_Context_And_Criteria_on_EnggItem_&_Resource
Get_Attached_Configuration_Context_and_criteria_on_System.txt

 

Detail Explanation

How to call web services

Steps followed for calling all web services.

  1. Create HTTP client.
  2. Define header for the HTTP client.
  3. Build web service URI.
  4. Perform GET/POST request.
  5. Retrieve the returned response code if it is zero / as per documentation then ok else error case.
  6. To retrieve the required content from the response traverse through returned data node or buffer.

For example – Below script calls web service to copy model dictionary on Mfg Item.

// 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"))

// Define URI parameters
let requestURI(String)
requestURI = "/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"
requestURI=requestURI+strPhysicalID
requestURI=requestURI + "/dscfg:Configured?\\\$mask=dsmvcfg:ConfiguredDetails&\\\$fields=dsmvcfg:attribute.enabledCriteria,dsmvcfg:attribute.isConfigured"

// Perform Get request – Below are the input arguments for HTTP request EKL action
/*I: iStrRequestType (String) - Valid values GET / POST
I: iStrAddRequestURL (String) - additional URL details of request
I: iListHeaders(List) - additional request headers
O: oStrBuffer (String) - returned buffer
O: oDTN (DataTreeNode) - returned data tree node
O: bIsReqSuccessful: (Boolean) - true if succeeded
I: iStrJSONLoad(String) - JSON Load in case of POST
*/

Let httpReqAction(AdvisorAction)
Let strJSONLoad, strOBuffer(String)
Let bIsReqSuccessful(Boolean)
strJSONLoad = ""
set httpReqAction = AccessResource("HTTP_Request","AdvisorAction")
httpReqAction.Run("GET", requestURI, headers, strOBuffer, oDTN, bIsReqSuccessful, strJSONLoad)

 

Here under some Use Case about possible adaptation of the script

1. Requirement 1: Get model configuration on other type of objects in structure

In above example we saw detailed explanation of how the script is written to get the Model dictionary of Mfg Item, there might be requirement where we need to get 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 get Model dictionary we will set its type.

Mfg ItemEng ItemSystemResource
MfgProcessOccurrenceProductOccurrenceProdSystemOccurrenceResourceOccurrence
  • Modify script to get physical ID of other type of object

In our example we used dsmfg/dsmfg:MfgItem, instead of that if get Model dictionary is to be done on System object then modify the corpus type as mentioned in below table.

Below table shows different types of corpuses that can be used in scripts:

Mfg ItemEng ItemSystemResource
dsmfg/dsmfg:MfgItemdseng/dseng:EngItemdsprcs/dsprcs:MfgProcessdsrsc/dsrsc:Resource
dsmfg:MfgItemInstancedseng:EngInstancedsprcs:MfgProcessInstancedsrsc:ResourceInstance
  dsprcs:MfgOperation 
  dsprcs:MfgOperationInstance 
  • Modify web service URI to get Model dictionary with respect to the corpus type

In our case we used dsmfg/dsmfg:MfgItem for Mfg Item, similarly for System object it needs to be modified dsprcs/dsprcs:MfgProcess, below is the code for reference.

Web Service URI for Mfg. Items:

// Define URI parameters for Mfg Item
let requestURI(String)
requestURI = "/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"
requestURI=requestURI+strPhysicalID
requestURI = requestURI + "/dscfg:Configured?\\\$mask=dsmvcfg:ConfiguredDetails&\\\$fields=dsmvcfg:attribute.enabledCriteria,dsmvcfg:attribute.isConfigured"

Web Service URI for Systems:

// Define URI parameters for System
let requestURI(String)
requestURI = "/resources/v1/modeler/dsprcs/dsprcs:MfgProcess/"
requestURI=requestURI+strPhysicalID
requestURI = requestURI + "/dscfg:Configured?\\\$mask=dsmvcfg:ConfiguredDetails&\\\$fields=dsmvcfg:attribute.enabledCriteria,dsmvcfg:attribute.isConfigured"

How to Deploy

Follow the guidelines given in the following video to deploy the EKL Scripts. 

​​​​​​​

Author

Author - @RR 

For any queries please reach out to - @KA