Attributes Initialization (PLMIdentificationInitialization)

PLMIdentificationInitialization lets you define and integrate the customer business logic for PLM entity initialization.

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.
Notes:
  • In an import context, the type you want to use must be retrieved using the RetrieveNamingParametersWithSeparator function.
  • You must create a rule defining that the value of the attributes that participate in the identification of objects of a given type must be unique. In a baseline behavior environment, make sure that the value of PLM_ExternalID is unique. To find out how to compute a unique identifier, see Reference Library: Enterprise Knowledge Language: Knowledge Packages: Social and Collaborative Apps: Business Logic Functions.

This page discusses:

General Information

This opening ID is called in the Content > New, Edit Properties, Sheet Editor dialogs and Assembly Symmetry dialogs each time the user manually modify an attribute value. The Attribute Valuation Propagation Business Logic has been called before applying the current propagation BL. The goal of the BL is to propagate attributes valuation ( Attri=f(Attrj) ) and manages attribute visibility.

The table below provides you with information related to the definition of the Opening ID.

Opening ID: PLMIdentificationInitialization
Customization intent: Execution
Execution context:
  • On the cloud: Client
  • On premises: Client/Server

Note: The PLMIdentificationInitialization BL must be implemented for and deployed on both client side and server side, even if only the native client is used.

Input Objects

This opening ID can be associated with component class types below. This is the fact (i.e. ThisObject) in the business rule.

Note: The fact can be either a Proxy or a Component.

Input objects must be of the following types:

  • ThisObject
  • Parameters corresponds to the context object.

Context Object Parameters

In addition to the fact object, context attributes are available in the scripting rule. Some parameter availability are based on OperationId and OperationDetail attribute combination. See the matrix below.

Parameter NamesTypesRead/WriteComments
OperationIdstringReadParameter used to identify the context of initialization. Following values are not exhaustive.
  • "New” for Component creation.
  • "Cloning" for Component duplication.
  • "Implicit" for Component creation by factory APIs with no specific context.
  • "ImportAsNew" for data import creating new Components.
  • "ImportAsRef" for object re-identification at import.
  • "Default" for any else case.
OperationDetailStringRead

Parameter to be used combined with OperationId parameter. Details the context of the OperationId. Following values are not exhaustive.

  • "NoOperationDetail"
  • "Create"
  • "CopyPaste"
  • "ConfiguredSplit"
  • "ReplaceReference"
  • "CloneDistantData" for "Duplicate As Alternative" command.
  • "AssemblySymmetry"

IdStringstringReadParameter that may be used for the naming of the PLM entity (e.g. as prefix).
IdCloningStringstringReadParameter that may be used for the naming of the PLM entity (e.g. as prefix).
CopyFromPLMEntityRead

PLM Proxy object of the source PLM entity to clone. Based on this object, the attributes values may be parameterized.

CoupledRefPLMEntityReadWhen creating a couple "PLM Part Reference/Representation Reference" in one shot, this parameter provides the PLM Proxy object of the aggregating Part Reference. Based on this object, the attributes values may be parameterized.
AggregatingReferencePLMEntityReadWhen creating a PLM Instance, this parameter provides a PLM Proxy object of the PLM Reference entity (i.e. OwnedBy) that will aggregate the PLM instance. Based on this object, the attributes values may be parameterized.
ReferencePLMEntityReadWhen creating a PLM Instance, this parameter provides a PLM Proxy object of the PLM Reference entity (i.e. (InstanceOf) of the this PLM instance. Based on this object, the attributes values may be parameterized.
PolicyStringReadPolicy name.
Summary of the available context for each OperationId:
  • Type of the fact object
  • OperationDetail
  • Context attribut parameters



Note: Depending on the context, some parameters may be unset. Therefore, it is necessary to check attribute validity before reading.

Sample

The following sample illustrates how to:

  • Initialize the naming of a stand alone Representation Reference based on a unique number computed by an external function of a user knowledge package.
  • Initialize the naming of a Representation Reference from the naming of a couple Part Reference (same PLM_ExternalID attribute prefixed by "3DRep of ")
  • Set the attributes on a cloned Representation Reference: the description of the cloned object is set to : "This Representation is a copy of Original object PLM_ExternalID"

To achieve this particular business logic implementation you will associate a rule (e.g. "MyRepIdentificationScript") with the couple <OpeningID, Type> in a CATRuleExit file:

<Scripts>
      <Script OpeningID="PLMIdentificationInitialization"
              Type="MyPLMRepresentation"
              ScriptName="MyRepIdentificationScript" />
</Scripts>              

Then you will create a business rule to define your business logic:
Let Operation(string)
Let CoupledRefId(string)
Let CoupledRef(PLMProductDS)
Let OriDesc(string)
Let CopyFrom(PLMProductDS)
Let CopyFromId(string)
Let CloningString(string)

Operation=Parameters->GetAttributeString("OperationId")

If(Operation=="New")
{
         /* Management of coupling between Representation Reference Naming and Part Reference naming */
                if (ThisObject->HasAttribute("AggregatingReference") == true)
                {
                               set AggregatingRef = ThisObject.AggregatingReference
                                if (AggregatingRef <> NULL)
                                {
                                               CoupledRefId = AggregatingRef.PLM_ExternalID
                                               ThisObject.PLM_ExternalID = Prefix+CoupledRefId
                               }
                                 else
                                {
                                               /* Default naming based on a customized numbering */
                                               Prefix = Parameters->GetAttributeString("IdString")
                                               ThisObject.PLM_ExternalID = Prefix +"Representation" 
                                }
                }
else
                {
                               /* Default naming based on a customized numbering */
                               Prefix = Parameters->GetAttributeString("IdString")
                               ThisObject.PLM_ExternalID = Prefix +"Representation" 
                }
}
else if(Operation=="Cloning")
{
         /* Case of cloning */
         if (Parameters->HasAttribute("IdCloningString") == true)
         {
                CloningString = Parameters->GetAttributeString("IdCloningString")
         }
         if(CloningString=="")  
         {
                CloningString = "Auto Renamed of "
         }
         /* retreive the attributes on the initial object */
         set CopyFrom = Parameters->GetAttributeObject("CopyFrom") 
         CopyFromId = CopyFrom->GetAttributeString("PLM_ExternalID")
         OriDesc = CopyFrom->GetAttributeString("V_description")
         ThisObject.PLM_ExternalID = CloningString + CopyFromId
         ThisObject.V_description = "This Representation is a copy of "+CopyFromId

Note: Before using an optional input parameter, you have to check its value. For example, to check if the CopyFrom parameter is valuated or not, use the following code sequence:
...
set CopyFromRef = GetAttributeObject("CopyFrom")
if(CopyFromRef <> NULL)
{
...

Assembly Symmetry sample

The following sample illustrates how to customize the name of new symmetric references.

Let OperationDetail(string)
Let CopyFrom(PLMProductDS)
Let CopyFromId(string)
Let Prefix(String)

OperationDetail=Parameters->GetAttributeString("OperationDetail")

If(OperationDetail=="AssemblySymmetry")
{
           /*Do specific treatments*/
           Prefix=Parameters->GetAttributeString("IdCloningString")
           CopyFrom=Parameters->GetAttributeObject("CopyFrom")
           CopyFromId = CopyFrom->GetAttributeString("PLM_ExternalID")
         ThisObject.PLM_ExternalID = Prefix + CopyFromId
}