Customizing Tree Color and Icon Masks

This function enables you to customize the background color of texts and the icon masks of Manufacturing Finder using rules based on attributes. The customization is based on knowledge rules using PLM attributes and is applied via the execution of script files.

This page discusses:

What Can Be Customized?

All references and representation references are customizable (instances are not customizable).

A different customization can be defined for different customized types, e.g. VPMReference and DELFmiFunctionReference.

How to Customize

First, define a family that will allow a rule to be rerouted according to object type.

The family is a CATRuleExit file, this file must be located in the following runtime view directory: <os>\resources\knowledge\scripts.

The rule is a CATRule file, this file must be located in the following runtime view directory: <os>\resources\knowledge\scripts.

These script files must be located in the following runtime view directory: <os>\resources\knowledge\scripts.

Syntax

Two Keywords are to be used in family files:

  • ManageColor, if you want your rule to control your colors.
  • ManageMask, if you want your rule to control your icon masks.

After that, in your CATRule file, you can condition the information you send by using following items:

  • Parameters->SetAttributeString("MyColor","255|255|255") to define three values, corresponding to the desired RGB values
  • Parameters->SetAttributeString("IconMask","I_Mask") to define the icon Mask Name

In the CATRule files: This object represents the customized object on which attributes need to be accessed so as to define rule.

If a rule is validated, it is via the above parameters (MyColor, IconMask) that the customization will be retrieved (parameters is an internal Keyword enabling access to attributes).

Note: The icon mask must be a png file, located in the runtime view ( <os>\resources\graphic\icons). The size of an icon mask should be 10*10 pixels.

Refresh Management

The attributes used in a rule so as to manage the Background color or the icon mask can change in the session. In some cases, their modifications are immediately taken into account:

  • Lock/Unlock
  • Maturity Management
  • Edit Properties

But in other cases, the only way to guarantee refreshed (up-to-date) information is to do an expand.

Tree Color Sample

The displayed nodes of a tree will have a background color driven by rules based on attributes.

Here is a customization sample based on script files (*.CATRuleExit and *.CATRule):

Finders_DSCustomization.CATRuleExit

<Scripts>
<!-- -->
<Script OpeningID="ManageColor"  Type="VPMReference"              ScriptName="Finders_Color_Custo"/>   
<Script OpeningID="ManageColor"  Type="VPMRepReference"           ScriptName="Finders_Color_Custo"/>  
<Script OpeningID="ManageColor"  Type="RFLVPMLogicalReference"    ScriptName="Finders_Color_Custo"/>   
<Script OpeningID="ManageColor"  Type="DELFmiFunctionReference"   ScriptName="Finders_Color_Custo"/>
</Scripts>

Finders_Color_Custo.CATRule

let UserId(String)
UserId = Parameters->GetAttributeString("UserID")
if (UserId == "...")
	Parameters->SetAttributeString("MyColor","0|255|255")
else
	Parameters->SetAttributeString("MyColor","255|255|0")

Icon Mask Sample

The displayed nodes of a tree will have icon masks driven by rules based on attributes.

Here is a customization sample based on script files (*.CATRuleExit and *.CATRule):

Finders_DSCustomization.CATRuleExit

<Scripts>
<!-- -->
<Script OpeningID="ManageMask"   Type="VPMReference"              ScriptName="Finders_Mask_Custo"/>   
<Script OpeningID="ManageMask"   Type="VPMRepReference"           ScriptName="Finders_Mask_Custo"/>   
<Script OpeningID="ManageMask"   Type="RFLVPMLogicalReference"    ScriptName="Finders_Mask_Custo"/>   
<Script OpeningID="ManageMask"   Type="DELFmiFunctionReference"   ScriptName="Finders_Mask_Custo"/>
</Scripts>

Finders_Mask_Custo.CATRule

Parameters->SetAttributeString("IconMask","I_TP")

Considerations

The following points must be taken into consideration:

  • Only tree mask attributes will be used to define rules.
  • No customization will be possible on instances.
  • The icon customization of multi-extended product is not managed.
  • If a Product has two extensions (Electrical and Resource), we will not be able to precisely define the icon to be used in the context (there is no management of this ambiguity).
  • Colors that you use should conform to the following list of predefined colors (using different colors may lead to visual discrepancies in terms of colors between the 3D shading and the tree nodes coloring in edition tabs):
    • 01 black rgb (0, 0, 0)
    • 02 navy rgb (0, 0, 128)
    • 03 blue rgb (0, 0, 255)
    • 04 darkgreen (0, 64, 0)
    • 05 green rgb (0, 128, 0)
    • 06 teal rgb (0, 128, 128)
    • 07 deepskyblue (0, 191, 255)
    • 08 lime rgb (0, 255, 0)
    • 09 cyan rgb (0, 255, 255)
    • 10 turquoise (64, 224, 208)
    • 11 chartreuse (127, 255, 0)
    • 12 maroon rgb (128, 0, 0)
    • 13 purple rgb (128, 0, 128)
    • 14 olive rgb (128, 128, 0)
    • 15 gray rgb (128, 128, 128)
    • 16 blueviolet (138, 43, 226)
    • 17 darkorchid (153, 50, 204)
    • 18 brown rgb (165, 42, 42)
    • 19 silver rgb (192, 192, 192)
    • 20 chocolate (210, 105, 30)
    • 21 plum (221, 160, 221)
    • 22 lavender (230, 230, 250)
    • 23 azure rgb (240, 255, 255)
    • 24 wheat (245, 222, 179)
    • 25 salmon (250, 128, 114)
    • 26 red rgb (255, 0, 0)
    • 27 fuschia rgb (255, 0, 255)
    • 28 orange (255, 165, 0)
    • 29 pink (255, 192, 203)
    • 30 gold (255, 215, 0)
    • 31 bisque rgb (255, 228, 196)
    • 32 darkorange (255, 140, 0)
    • 33 cornsilk (255, 248, 220)
    • 34 snow (255, 250, 250)
    • 35 yellow rgb (255, 255, 0)
    • 36 ivory (255, 255, 240)
    • 37 white rgb (255, 255, 255)