CATRule to Format Labels for Items

Using a CATRule, you can specify the format of labels that are created on Manufacturing Items in the views using the Label command from the Instructions Authoring section of the action bar.

This page discusses:

General Information

The following table provides you with information related to the definition of the opening ID.
PLM Opening ID DELWKIDMULabelProperties_BL_ID
Customization intent Execution
Execution context Client
CATRuleExit DELWKIDMULabelProperties.CATRuleExit
Sample CATRule DELWKIDMULabelPropertiesForMfgItem.CATRule

This BL is invoked when you author Labels on Manufacturing Items using Label from the Instructions Authoring section of the action bar.

Input Arguments

Input Object Read/Write Type Comments
ThisObject The selected-object in a single-selection or the first object in the multiselection on which the Marker is created.
Note: ThisObject is of type DELFmiFunctionReference.
list_object_occurrence Read List The list of Mfg Item occurrence or Resource Occurrence or Operation-Output selected for the creation of the Markers.
list_object_reference Read List The list of references corresponding to occurrences coming in list_object_occurrence.
list_buildup_type Read List The list of string specifying the buildup type of the occurrences coming in list_object_occurrence.
operation_occurrence Read

The Active-Operation under which Marker’s owning 3D-Documenation-Rep is contained.

list_object_implementing_DSRole Read List The list of default-roles that are defined on the implement links to item/resource.
list_object_implementing_CustoRole Read List

The list of custom-roles that are defined on the implement links pointing to item/resource.

list_object_implementing_CustoActions Read List

The list of custom actions that are defined on the implement links between the operation and the pointing Items.

There will be one list of actions for each pointed item. All these lists will be included/embedded inside the main input argument list.

Output Arguments

Output Object Read/Write Type Comments
output_text Write List List of String – Fill with multiple strings, one for each line of text in the Label.
output_format Write List

Nested list - List of (List of 2 Strings -with attribute name, value) - Fill with multiple-list specifying the format-properties. Each sublist contains two strings, one for the format attribute name and another for the format attribute value.

For example: OutputFormatList.Append(List("fontName", "arial.ttf"))

Following are the supported properties.

Format name Value Example Value
fontName stringValue The supported formats are PostScript Type 1 format, TrueType font format, and OpenType format. Find the available font name from the 'fonts' directory in the installation folder ...\resources\fonts\TrueType\.... Use the file name as the font name.
fontSize stringValue Any value from "1" to "99"
fontColor stringValue Use RGB values to specify color. For example "255, 0, 0" for red
backgroundColor stringValue Use RGB values to specify color (See previous for example)
borderColor stringValue Use RGB values to specify color (See previous for example)
borderThickness stringValue "1" to "8" (1 being the most thin, 8 being the most thick)
borderLineType stringValue "0" to "7" (0 is no border, 1 is a solid line, etc.)
leaderEndType stringValue

"0" for Leader with Arrow end type

"1" for Leader with Circle end type

"2" for no Leader end type

transparency stringValue Use transparency value from "0" to "100"
fillVisibility stringValue Use value 0 to define no fill, otherwise use value 1
borderVisibility stringValue Use value 0 to define no border, otherwise use value 1
leaderVisibility stringValue Use value 0 to define no leader, otherwise use value 1

Sample

A complete example file is available in ..\resources\knowledge\scripts\DELWKIDMULabelPropertiesForMfgItem.CATRule.

Sample-BL does the following:

  • Gets the input values from BL-Parameter list_object_occurrence, list_object_reference, and list_buildup_type.
  • Gets the name of objects that to display in Label in a string-list from inputs list_object_occurrence or list_object_reference.

    Defines the collected name-list as value on the BL-Parameter output_text.

  • Defines the background color (backgroundColor) based on the build-up-type list_buildup_type.
    • For example, if the selected objects are of Manufacturing-Items, the background of a set with different colors – yellow color if the build-type is Current, Blue if BuildUp-Type is Previous.
    • For example, if the selected objects are mix of Manufacturing-Item and Resource-type, the background color is white.
  • Defines appropriate values for label properties (format) and defines on the BL-Parameter output_format.
//==========================================================
// SECTION-1: variables
//==========================================================

// Input Arguments
let ObjectRefList(List)
let ObjectOccList(List)
let BuildupTypeList(List)
let objOperationOcc(ProdSystemOccurrence) 
let listIL_DSRoles(List)
let listIL_CustoRoles(List)
let listIL_CustoActions(List)

// Output Arguments
let OutputTextList(List)
let OutputFormatList(List)

// Other variables
let strBackgroundColor(String)
let strTextLine1(String)
let strTextLine2(String)
let strTextLine3(String)
let strTextLine4(String)
let strBuildupOfPreviousItem(String)
let strCurBuildupType(String)
let isBuildupStatusOrTypeDifferent(boolean)
let size(integer)
let strDisName_Ref(String)
let strDisplayName(String)
let strFinalDisplayName(String)
let strDisplayDefaultRole(String)
let strDisplayCustoRole(String)
let strDisplayCustoActions(String)
let jj(integer)

//==========================================================
// SECTION-2: Get the inputs to the BL
//==========================================================
set ObjectRefList = Parameters->GetAttributeObject("list_object_reference")
set ObjectOccList = Parameters->GetAttributeObject("list_object_occurrence")
set BuildupTypeList = Parameters->GetAttributeObject("list_buildup_type")
set objOperationOcc = Parameters->GetAttributeObject("operation_occurrence")
set listIL_DSRoles = Parameters->GetAttributeObject("list_object_implementing_DSRole") 
set listIL_CustoRoles = Parameters->GetAttributeObject("list_object_implementing_CustoRole") 
set listIL_CustoActions = Parameters->GetAttributeObject("list_object_implementing_CustoActions") 


//==========================================================
// SECTION-3: Get the name to display - after checking each object
//==========================================================

//---------------------------
// Common Logic for all Label CATRules
//---------------------------
//   The objects pointed to by a Multi Leader Marker may be of different types - Item, Operation (Output) or Resource
//   For each pointed object
//      1.  First check if the pointed object is an Item,
//      2.  If not of above type, check if it is an Operation (Output)
//      3.  If not of above type, check if it is a Resource
//      4.  If not of above type, check if it is a Product
//---------------------------

size = ObjectRefList.Size()
isBuildupStatusOrTypeDifferent = false
strBuildupOfPreviousItem=""

jj =1
for jj while jj <=size
{
    // Build-Up Type
    strCurBuildupType = BuildupTypeList[jj]

    // Manufacturing Item.
    let objMfgItemReference(DELFmiFunctionReference)
    let objMfgItemOccurrence(FProcessOccurrence)
    set objMfgItemReference = ObjectRefList[jj]  // If pointed object is a valid DELFmiFunctionReference, objMfgItemReference will not be NULL 
    set objMfgItemOccurrence = ObjectOccList[jj] // If pointed object is a valid FProcessOccurrence, objMfgItemOccurrence will not be NULL 

    // Operation-Output.
    let objOperationReference(PLMOperation)
    let objOperationOccurrence(ProdSystemOccurrence)
    set objOperationReference = ObjectRefList[jj]   // If pointed object is a valid PLMOperation, objOperationReference will not be NULL 
    set objOperationOccurrence = ObjectOccList[jj]  // If pointed object is a valid ProdSystemOccurrence, objOperationOccurrence will not be NULL 

    // Resource.
    let objResourceReference(Resource)
    let objResourceOccurrence(ResourceOccurrence)
    set objResourceReference = ObjectRefList[jj]   // If pointed object is a valid Resource, objResourceReference will not be NULL 
    set objResourceOccurrence = ObjectOccList[jj]  // If pointed object is a valid ResourceOccurrence, objResourceOccurrence will not be NULL 

    // Product.
    let objProdRef(VPMReference)
    let objProdOcc(ProductOccurrence)
    set objProdRef = ObjectRefList[jj]   // If pointed object is a valid Product-Reference, objProdRef will not be NULL 
    set objProdOcc = ObjectOccList[jj]  // If pointed object is a valid Product-Occurrence, objProdOcc will not be NULL 

    //---------------------------
    // Identifying the type of pointed object.
    //---------------------------
    if( objMfgItemOccurrence <> NULL )
    {
        // Pointed object is an Item 
        strDisplayName = objMfgItemOccurrence.Name
        if ( objMfgItemReference <> NULL )
        {
            strDisName_Ref = objMfgItemReference.Name
        }
        strFinalDisplayName = strDisplayName
        strDisplayDefaultRole = "Default Role: " + listIL_DSRoles[jj]
        strDisplayCustoRole = "Custo Role: " + listIL_CustoRoles[jj]

        // Sample for Actions - START        
        let listILActions_ForThisItem(List)
        set listILActions_ForThisItem = listIL_CustoActions[jj]
        let sizeActions(Integer)
        sizeActions = listILActions_ForThisItem.Size()
        let aa(Integer)
        aa = 1
        strDisplayCustoActions = ""
        for aa while aa <=sizeActions
        {
           let currentAction(String)
           currentAction = listILActions_ForThisItem[aa]
           if (aa > 1)
           {
              strDisplayCustoActions = strDisplayCustoActions + ", "
           }
           else
           {
              strDisplayCustoActions = strDisplayCustoActions + "Custo Actions: "
           }
           strDisplayCustoActions = strDisplayCustoActions + currentAction
        }
        // Sample for Actions - END
    }
    else if(objOperationOccurrence <> NULL)
    {
        // Pointed object is an Operation (Output) 
        strDisplayName = objOperationOccurrence.Name
        if ( objOperationReference <> NULL )
        {
            strDisName_Ref = objOperationReference.Name
        }
    }
    else if(objResourceOccurrence <> NULL)
    {
        // Pointed object is a Resource 
        if( objResourceReference <> NULL)
        {
            // Name attribute was returning longer name, so it is replaced with V_Name attribute 
            strDisplayName = objResourceReference.V_Name + objResourceReference.revision + "(" + objResourceOccurrence.Name + ")"
            strDisName_Ref = objResourceReference.Name
        }
        else
        {
            strDisplayName = objResourceOccurrence.Name
        }
        strCurBuildupType = "No Build Up"
    }
    else if(objProdOcc <> NULL)
    {
        // Pointed object is a Product                            
        // it is a Product-Sub-Component of Capable-Resource 
        if( objProdOcc <> NULL)
        {
            // Name attribute was returning longer name, so it is replaced with V_Name attribute 
            strDisplayName = objProdRef.V_Name + objProdRef.revision + "(" + objProdOcc.Name + ")"
            strDisName_Ref = objProdRef.Name
        }
        else
        {
            strDisplayName = objProdRef.Name
        }
        strCurBuildupType = "No Build Up"
    }
    else
    {
       // Pointed object is an Unhandled Type 
       strDisplayName = "Unhandled Type: "
    }

    //---------------------------
    // setting display name - in OutputTextList
    //---------------------------
    if (strDisplayName <> "")
    {
        //strTextLine1 =  strDisplayName
        strTextLine1 = strFinalDisplayName
        strTextLine2 = strDisplayDefaultRole
        strTextLine3 = strDisplayCustoRole
        strTextLine4 = strDisplayCustoActions
        OutputTextList.Append(strTextLine1)
        OutputTextList.Append(strTextLine2)
        OutputTextList.Append(strTextLine3)
        OutputTextList.Append(strTextLine4)
    }
    else if(strDisName_Ref <> "")
    {
        strTextLine1 = strDisName_Ref
        OutputTextList.Append(strTextLine1)
    }
    else
    {
        strTextLine1 = "No Name Available"
        OutputTextList.Append(strTextLine1)
    }

    //---------------------------
    // check if objects are of different build-up types
    //---------------------------
    // for the first item, strBuildupOfPreviousItem will be null-string - set it as same as Curr build-up type.
    if (strBuildupOfPreviousItem == "") // for first object in list, strBuildupOfPreviousItem will be null
    {
        strBuildupOfPreviousItem = strCurBuildupType
    }

    // flag if Build-up status are different
    if (isBuildupStatusOrTypeDifferent == false And strBuildupOfPreviousItem <> strCurBuildupType )
    {
        isBuildupStatusOrTypeDifferent = true
    }

} // END_OF_[[for jj while jj <=size]]


//==========================================================
// SECTION-4: defining label back-ground color based on Buildup Type
//==========================================================
if(isBuildupStatusOrTypeDifferent) // Pointed objects are of different buildup status or type, background color is white 
{
    strBackgroundColor = "255, 255, 255"
}
else if (strBuildupOfPreviousItem == "No Build Up") // For Resource, background color is green 
{
    strBackgroundColor = "0, 255, 0"
}
else if (strBuildupOfPreviousItem == "Current") // yellow 
{
    strBackgroundColor = "255, 255, 0"
}
else if (strBuildupOfPreviousItem == "Parallel") // orange 
{
    strBackgroundColor = "255, 165, 0"
}
else if (strBuildupOfPreviousItem == "Context") // grey 
{
    strBackgroundColor = "209, 209, 209"
}
else if (strBuildupOfPreviousItem == "Previous in System") // light blue 
{
    strBackgroundColor = "100, 200, 255"
}
else // For Previous - blue 
{
    strBackgroundColor ="0, 128, 255"
}


//==========================================================
// SECTION-5: Set-Label Format
//==========================================================
OutputFormatList.Append(List("fontName", "arial.ttf"))
OutputFormatList.Append(List("fontSize", "4"))
OutputFormatList.Append(List("fontColor", "0, 0, 0"))
OutputFormatList.Append(List("backgroundColor", strBackgroundColor))
OutputFormatList.Append(List("borderColor", "0, 0, 0"))
OutputFormatList.Append(List("borderThickness", "1"))
OutputFormatList.Append(List("borderLineType", "1"))
OutputFormatList.Append(List("leaderEndType", "0"))
OutputFormatList.Append(List("transparency", "0")) // when fillVisibility=0, transparency setting won't be effective
OutputFormatList.Append(List("fillVisibility", "1")) // when fillVisibility=0, transparency setting won't be effective
OutputFormatList.Append(List("borderVisibility", "1"))
OutputFormatList.Append(List("leaderVisibility", "1"))


//==========================================================
// SECTION-6: Set outputs on BL-Parameters object
//==========================================================
Parameters->SetAttributeObject("output_text", OutputTextList)
Parameters->SetAttributeObject("output_format", OutputFormatList)