Introduction
Usage : Define which instance attributes are to be copied or not on newly created instance using Manipulate Symbols command
Datasetup Resource Set :
- Diagram Resource
Datasetup Resource : Rule to manage instance attribute copy
Rule Example 1
Description
the rule below copies the attributes only on the newly created instance, when the Instantiate option is selected in the Manipulation Options Chooser dialog box. if cut/past option is selected, the attributes values are not copied
Rule
// ThisObject --> LogicalOccurence Notify ("==> Copy/Forbid Attributes Start ") let lSelected_Instances (List) let lCopied_Instances (List) let dManipOption(Integer) let bIsListToForbidAttrs(Boolean) let oList_Instance_Attributes (List) let strAttributeName (String) set lSelected_Instances = Parameters->GetAttributeObject("List_Selected_Instances") set lCopied_Instances = Parameters->GetAttributeObject("List_Copied_Instances") set dManipOption = Parameters->GetAttributeInteger("Network_Manip_Option") set strAttributeName = "V_description" oList_Instance_Attributes.Append(strAttributeName) set strAttributeName = "PLM_ExternalID" oList_Instance_Attributes.Append(strAttributeName) set strAttributeName = "V_PredefinedPartType" oList_Instance_Attributes.Append(strAttributeName) set strAttributeName = "V_PLE_TagNumber" oList_Instance_Attributes.Append(strAttributeName) if (dManipOption == 1) // Copy attributes in Instantiation option { Notify ("==> Copy 4 Instance Attributes ") set bIsListToForbidAttrs = FALSE } else if (dManipOption == 4) // Forbid attibutes in Cut-Paste { Notify ("==> Forbid 4 Instance Attributes ") set bIsListToForbidAttrs = TRUE } Parameters.SetAttributeObject("List_Instance_Attributes", oList_Instance_Attributes) Parameters.SetAttributeBoolean("Is_ListTo_Forbid_Attrs", bIsListToForbidAttrs) Notify ("==> Copy/Forbid Attributes End")
3DXML
Rule Example 2
Description
Attribute Propagation - for Instantiate mode
Rule
This Object = LogicalOccurence Notify ("==> Copy/Forbid Attributes Start ") let lSelected_Instances (List) let lCopied_Instances (List) let dManipOption(Integer) let bIsListToForbidAttrs(Boolean) let oList_Instance_Attributes (List) let strAttributeName (String) set lSelected_Instances = Parameters->GetAttributeObject("List_Selected_Instances") set lCopied_Instances = Parameters->GetAttributeObject("List_Copied_Instances") set dManipOption = Parameters->GetAttributeInteger("Network_Manip_Option") //List of attribute to process set strAttributeName = "V_description" oList_Instance_Attributes.Append(strAttributeName) set strAttributeName = "Attribute2" oList_Instance_Attributes.Append(strAttributeName) set strAttributeName = "Attribute3" oList_Instance_Attributes.Append(strAttributeName) set strAttributeName = "Attribute4" oList_Instance_Attributes.Append(strAttributeName) /* Network manipulation option selected 1 = Instantiate 2 = Duplicate 3 = Business Rule 4 = Cut-Paste TRUE means output list List_Instance_Attributes is list of attributes not to be copied on new instance. FALSE means output list List_Instance_Attributes is list of attributes to be copied on new instance */ if (dManipOption == 1) // Copy attributes in Instantiation option { Notify ("==> Copy 4 Instance Attributes ") set bIsListToForbidAttrs = FALSE } else if (dManipOption == 4) // Forbid attibutes in Cut-Paste { Notify ("==> Forbid 4 Instance Attributes ") set bIsListToForbidAttrs = TRUE } Parameters.SetAttributeObject("List_Instance_Attributes", oList_Instance_Attributes) Parameters.SetAttributeBoolean("Is_ListTo_Forbid_Attrs", bIsListToForbidAttrs) Notify ("==> Copy/Forbid Attributes End")
Rule Example 3
Description
Attribute Propagation for BusinessRule Mode – Duplicate EQT
Rule
/* CATRule signature: (ThisObject : #In LogicalOccurrence, Parameters : #In RuleContext) : #Void */ /* Sample rule*/ /* Input parameter is List of PLM Occurrences*/ /* Output parameter is List of integers, which is one to one mapping with List Of PLM Occurrences, 1 means instantiate and 2 means Duplicate*/ /* In this sample rule, we fill 2 in output list for Equipments and 1 for all other objects*/ /* Input parameters read */ let This2DObject (LogicalOccurrence) let ListPLMOccurrences(LIST) set ListPLMOccurrences = Parameters.GetAttributeObject ("List_PLM_Occurrences") let OutputInsDupOptionsList(List) Let ReferenceObject(RFLVPMLogicalReference) let OccurrenceObject (LogicalOccurrence) let sDiscipline (String) Let j = 1 for j while j<=ListPLMOccurrences->Size() { set OccurrenceObject = ListPLMOccurrences->GetItem(j) set ReferenceObject = OccurrenceObject.Reference sDiscipline = ReferenceObject.V_discipline if(sDiscipline == "EnsLogicalEquipment") OutputInsDupOptionsList.Append(2) else OutputInsDupOptionsList.Append(1) j = j+1 } Parameters.SetAttributeObject("List_Instantiate_Duplicate_Options", OutputInsDupOptionsList)