EKL - Manage Predefined Part Type and Part Number Attributes

Introduction

Usage : hen you edit the Predefined Part Number and Predefined Part Type attributes of a logical piping part reference.

Datasetup Resource Set : 

  • Piping/Tubing Specification Resources

Datasetup Resource : Manage Predefined Part Type and Part Number

 

Rule Example

 

/*
GetAttributeValue (input)     Boolean     Read     Sets or gets the attributes' values available in ListAttributeName.
ListAttributeName (input)     List     Read     Defines the list of attributes' names.
ListAttributeValueToSet (input)     List     Read     Defines the input argument.
ListComputedAttributeValue (output)     List     Read     Defines the output argument. 
*/

Let GetAttributeValue_Boolean (Boolean)
Let AttributeName_List (List)
Let AttributeValueToSet_String (List)
Let ComputedAttributeValue_List (List)
Let AttrNameString (String)
Let AttrValueString (String)
Let ThisReference1 (PLMEntity)
Let ThisInstance (RFLVPMLogicalInstance)
Let PreviousStringInDesc(String)
Let IndexForNextLine(Integer)
Let LengthOfString(Integer)
Let PredefinedPartType(String)
Let PredefinedPartNumber(String)

ComputedAttributeValue_List = Parameters.GetAttributeObject("ListComputedAttributeValue")
GetAttributeValue_Boolean = Parameters.GetAttributeBoolean("GetAttributeValue")

set AttributeValueToSet_String = Parameters.GetAttributeObject("ListAttributeValueToSet")

/*
Let Piping_Logical_Part_Inst1 (Piping_Logical_Part_Inst)
.V_PredefinedPartNumber 
.V_PredefinedPartType 

Let Piping_Logical_Part1 (Piping_Logical_Part)
.V_LogicalSubPartType 
*/

set ThisInstance = ThisObject.Instance
if(GetAttributeValue_Boolean == true) /* GET */
{
    if (ThisInstance.HasAttribute("V_PredefinedPartType") == true )
    {
        PredefinedPartType = ThisInstance.GetAttributeString("V_PredefinedPartType")
    }
    if (ThisInstance.HasAttribute("V_PredefinedPartNumber") == true )
    {
        PredefinedPartNumber = ThisInstance.GetAttributeString("V_PredefinedPartNumber")
    }
    ComputedAttributeValue_List.Append(PredefinedPartType)
    ComputedAttributeValue_List.Append(PredefinedPartNumber)    
    
    Parameters.SetAttributeObject("ListComputedAttributeValue", ComputedAttributeValue_List)
}
else /* SET */
{
    AttrValueString = AttributeValueToSet_String.GetItem(1)
    
    AttributeName_List = Parameters.GetAttributeObject("ListAttributeName")
    AttributeName_List.Size()
    AttrNameString = AttributeName_List.GetItem(1)
    
    if(AttrNameString == "V_PredefinedPartType")
    {
        if (ThisInstance.HasAttribute("V_PredefinedPartType") == true )
        {
            ThisInstance.SetAttributeString( "V_PredefinedPartType", AttrValueString)
        }
    }
    else
    {
        if (ThisInstance.HasAttribute("V_PredefinedPartNumber") == true )
        {
            ThisInstance.SetAttributeString("V_PredefinedPartNumber", AttrValueString)
        }
    }
}