Unset Variant Effectivity on Mfg Item, Engg. Item, Systems & Resources

Introduction

This document intended to provide a detailed guide and examples on how to write EKL script to unset variant effectivity on Mfg Item.

Along with unset variant effectivity on Mfg Item there are example EKL actions to unset variant effectivity on Engineering Item, Resource and System.

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 for this unset effectivity EKL script is 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.

 

Unset Variant Effectivity on Mfg. Item
Unset Variant Effectivity on Eng. Item & Resource
Unset Variant Effectivity on System

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 unset effectivity of Mfg Item instance.

// unset Effectivity on Instance found in above step           

// Creates an HTTP client

client = CreateHTTPClient()        

// Defines Headers

client.AddRequestHeaders("Content-Type: application/json")

client.AddRequestHeaders("Accept: application/json")

client.AddRequestHeaders("SecurityContext: "+securityCtx)

client.AddRequestHeaders("ENO_CSRF_TOKEN: "+csrfToken)      



Let jsonBody(String)

// Defines URI and Body

iURI = serverURL +"/resources/v1/modeler/dscfg/invoke/dscfg:unsetVariant"

jsonBody = "[{"

             jsonBody = jsonBody + "\\"identifier\\": \\""+strSelctMfgItemInstPID+"\\","

             jsonBody = jsonBody + "\\"type\\": \\"dsmfg:MfgItemInstance\\","

             jsonBody = jsonBody + "\\"source\\": \\"3DSpace\\","

             jsonBody = jsonBody + "\\"relativePath\\": \\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strFatherRefPid+"/dsmfg:MfgItemInstance/"+strSelctMfgItemInstPID+"\\""

    jsonBody = jsonBody + "}]"



//Performs a POST request

oBuffer = client.Post(iURI, "HTTPDEFINED", jsonBody, oDTN)



// Checking if request return code is OK (rc = 0)

if (client.ReturnCode == 0)

{

    // success

    //PopupMessage("client.ReturnCode - #, oBuffer - #", client.ReturnCode, oBuffer)

    PopupMessage("Successfully Unset variant effectivity.on selected Mfg Item.")

    // Refresh session with selected Item

    /*Let lEntities(List)

    lEntities.Append(selMfgItemOcc)

    RefreshEntities(lEntities, false)*/

}

else

{

    // failure

    PopupMessage("client.ReturnCode - #, oBuffer - #", client.ReturnCode, oBuffer)

}

Get selected instance / Relationship Object ID

To unset / set / get variant effectivity it needs instance / relationship object ID.

 

  • To get instance Object ID:

//Get instance name of selected Mfg Item

Let selMfgItemInst(PLMCoreInstance)

set selMfgItemInst = selMfgItemOcc.Instance

//Get Physical ID of selected Mfg Item instance

let strSelctMfgItemInstPID(String)

strSelctMfgItemInstPID=selMfgItemInst.GetPhysicalId()

 

  • To get object ID of Father Mfg. Item reference:

let selMfgItemFatherRef(DELFmiFunctionReference)

let selMfgItemFatherOcc(MfgProcessOccurrence)

let strFatherRefPid(String)

set selMfgItemFatherOcc=selMfgItemOcc.Owner

if(selMfgItemFatherOcc <>NULL)


	//Get Physical ID of owner / father of selected object which has configuration model attached.

	selMfgItemFatherRef=selMfgItemFatherOcc.Reference

	strFatherRefPid=selMfgItemFatherRef.GetPhysicalId()

 

 

Here under some Use Case about possible adaptation of the script

1. Requirement 1: unset variant effectivity of other type of objects in structure

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

Mfg ItemEng ItemSystemResource
MfgProcessOccurrenceProductOccurrenceProdSystemOccurrenceResourceOccurrence
  • Change below father occurrence type as shown in above table.
// For Mfg Item
Let selFatherMfgItemOcc(MfgProcessOccurrence)

// For Eng Item
Let selFatherEngItemOcc(ProductOccurrence)

// For System
Let selFatherSystemItemOcc(ProdSystemOccurrence)

// For Resource
Let selFatherResourceItemOcc(ResourceOccurrence)
  • Use respective corpus type

In our example we used dsmfg/dsmfg:MfgItem instead of that if unset effectivity is to be done on system object then use dsprcs/dsprcs:MfgProcess similar for other type of objects.

Mfg ItemEng ItemSystemResource
dsmfg/dsmfg:MfgItemdseng/dseng:EngItemdsprcs/dsprcs:MfgProcessdsrsc/dsrsc:Resource
dsmfg:MfgItemInstancedseng:EngInstancedsprcs:MfgProcessInstancedsrsc:ResourceInstance
  dsprcs:MfgOperation 
  dsprcs:MfgOperationInstance 
FOR EXAMPLE
//Web Service Search Query with Parameter for Mfg Item
requestURI= serverURL + "/resources/v1/modeler/dsmfg/dsmfg:MfgItem/search?\\\$searchStr=" + PLMID + "&\\\$top=50&\\\$skip=0"

//Web Service Search Query with Parameter for System 
requestURI= serverURL + "/resources/v1/modeler/dsprcs/dsprcs:MfgProcess/search?\\\$searchStr=" + PLMID + "&\\\$top=50&\\\$skip=0"

2. Requirement 2: Unset Evolution effectivity on Mfg Item

Above example shows how to unset variant effectivity on Mfg Item, similarly if user want to unset Evolution effectivity then below are some changes required in above EKL script.

  • Web service URI

Modify web service URI as shown below,

 // For unsetVariant Effectivity Define URI as below,
iURI = serverURL +"/resources/v1/modeler/dscfg/invoke/dscfg:unsetVariant"

// For unsetEvolution Effectivity Define URI as below,
iURI = serverURL +"/resources/v1/modeler/dscfg/invoke/dscfg:unsetEvolution"
  • JSON Body

Build JSON request body as shown below with required identifiers and evolution expression. For more details refer Developer assistance for 2021x.

// Defines URI and Body For unsetVariant Effectivity
iURI = serverURL +"/resources/v1/modeler/dscfg/invoke/dscfg:unsetVariant"
jsonBody = "[{"
                   jsonBody = jsonBody + "\\"identifier\\": \\""+strSelctMfgItemInstPID+"\\","
                   jsonBody = jsonBody + "\\"type\\": \\"dsmfg:MfgItemInstance\\","
                   jsonBody = jsonBody + "\\"source\\": \\"3DSpace\\","
                   jsonBody = jsonBody + "\\"relativePath\\": \\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strFatherRefPid+"/dsmfg:MfgItemInstance/"+strSelctMfgItemInstPID+"\\""
jsonBody = jsonBody + "}]"

// Defines URI and Body For unsetEvolution Effectivity
iURI = serverURL +"/resources/v1/modeler/dscfg/invoke/dscfg:unsetEvolution"
jsonBody = "[{"
                   jsonBody = jsonBody + "\\"identifier\\": \\""+strSelctMfgItemInstPID+"\\","
                   jsonBody = jsonBody + "\\"type\\": \\"dsmfg:MfgItemInstance\\","
                   jsonBody = jsonBody + "\\"source\\": \\"3DSpace\\","
                   jsonBody = jsonBody + "\\"relativePath\\": \\"/resources/v1/modeler/dsmfg/dsmfg:MfgItem/"+strFatherRefPid+"/dsmfg:MfgItemInstance/"+strSelctMfgItemInstPID+"\\""
jsonBody = jsonBody + "}]"

For example – below is an example of JSON body to pass to unsetEvolution Effectivity web service method.

[
{
    "identifier": "F6AF82561E5700005EB271EE0003C500",
    "type": "dseng:EngInstance",
    "source": "3DSpace",
    "relativePath": "/resources/v1/modeler/dseng/dseng:EngItem/F6AF82561E5700005EB123650003C100/dseng:EngInstance/F6AF82561E5700005EB271EE0003C500"
}
]
  • Note – Always use internal name for all variant values, features, Model name, product state, etc...

How to Deploy

Follow below steps to deploy the above EKL script

  1. Download the Provided EKL Script
  2. Create one new "Physical Product" to act as a container for the EKL action and give it some suitable name. For ex. "Unset_Variant_Effectivity_EKL_scripts"
  3. Create a new "Knowledge Action" in the newly created Physicals Product and give it a suitable name. Follow the sample video available on this page to know "How to create Knowledge Action".
  4. Set the input arguments as explained at the top of the script in the "Input output argument" comment.
  5. Save the script
  6. Execute the script

Author

Author - @RR  

Person of Contact -  @KA ​​​​​​​