Rule to Choose a Representation (Schematic_GetSymbol_GraphicAttr_FromRepMode)

An opening ID is an entry point used to customize business logic. The Schematic_GetSymbol_GraphicAttr_FromRepMode opening ID provides information about the symbol to be used during the placement and also apply graphic properties on the symbols or routes based on the main and called representations' graphics properties. Main and Called Representations can have different graphic properties.

You can display different graphical representations for equipment, connectors, connector ports, and pins based on the specified view properties.

Note: For more information about customization by business rules, see Customization by Business Rules.

This page discusses:

General Information

This opening ID is invoked when a new symbol or route is placed in a diagram view using one of the following commands:

  • Create New Reference
  • Insert New Reference
  • Insert Existing Reference
  • Create From Existing Reference
  • Insert From Catalog
  • Place in View
  • Route in View
  • Create Route

To manage multiple representations of an equipment, a connector, a connector port, or a pin, several symbols must be included within the symbol reference. Each symbol must have a unique name, which will be processed by the business rule. The sheet or view properties are used by the business rule to determine the appropriate graphical representation.

Definition Description
PLM Opening ID Schematic_GetSymbol_GraphicAttr_FromRepMode
Customization intent Execution
Execution context Client

Input Objects

Input objects must be of the following types:

  • ThisObject: Logical Occurrence
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter Name Type Read or Write Comments
Is_Main (input) Boolean Read States the current representation as main or called.
List_All_Symbol_Names (input) List Read

Lists the names of symbol references available for the input object.

Symbol_Name (output) String Write

The name of the symbol reference to be used to represent a logical object.

Alternate_Rep_Name (output) String Write The name of alternate representation to be activated.
List_Visualization_Attr_Names (output) List Write Names of visualization attributes which can be on the symbol:
  • Sch_LineColor : Expected value is list of integers (R, G, B)
  • Sch_LineThickness: Expected value is integer
  • Sch_LineType : Expected value is integer
List_Visualization_Attr_Values (output) List Write

Values of visualization attributes

to be applied on the symbol.

Main and Called Representations Management

In the following sample, the rule returns a different symbol name and graphic attributes for main and called representations.

Let sSymbolName(string)
Let LGraphicAttrNames(list)
LGraphicAttrNames.Append("Sch_LineColor")
LGraphicAttrNames.Append("Sch_LineThickness")
LGraphicAttrNames.Append("Sch_LineType")
Let LGraphicAttrValues(list)
Let LRGB(list)
Let bIsMain(Boolean)
set bIsMain = Parameters.GetAttributeBoolean("Is_Main")
if(true == bIsMain)
{
                set sSymbolName="MainSymbol"
                LRGB.Append(0)
                LRGB.Append(255)
                LRGB.Append(0)
                LGraphicAttrValues.Append(LRGB)
                LGraphicAttrValues.Append(2)
                LGraphicAttrValues.Append(1)
}
else if(false == bIsMain)
{
                set sSymbolName="CalledSymbol"
                LRGB.Append(255)
                LRGB.Append(0)
                LRGB.Append(0)
                LGraphicAttrValues.Append(LRGB)
                LGraphicAttrValues.Append(5)
                LGraphicAttrValues.Append(3)
}
Parameters.SetAttributeString("Symbol_Name", sSymbolName)
Parameters.SetAttributeObject("List_Visualization_Attr_Names", LGraphicAttrNames)
Parameters.SetAttributeObject("List_Visualization_Attr_Values" , LGraphicAttrValues)

Multiple Graphical Representation

To manage multiple representations of an equipment, a connector, a connector port, or a pin, several symbols must be included within this symbol reference. Each symbol must have a unique name, which is determined by the rule implemented.

In the following rule, the symbol name to be displayed is selected based on the value found in the description of the active view, which determines the type of view. For each symbol name provided as input, the rule checks if the symbol name ends with the view type. The rule then returns the symbol name that matches the view type.

Let ListSymbolNames(list)
set ListSymbolNames = Parameters.GetAttributeObject("List_All_Symbol_Names")

//Notify ("Start nb symbol #", ListSymbolNames.Size())

if ( ListSymbolNames.Size() > 0 )
{
  //Notify ("ListSymbolNames")	
  
  //Retrieves the active sheet an view 
  let currentSheet(DifSheet)
  let currentViewInst(DifViewInstance)
  GetSchActiveSheetAndView(currentSheet, currentViewInst)	
  
  if (currentViewInst <> NULL) 
  {  	
    Let ViewType(String)
        
    //Notify ("currentViewInst")    
    if (currentViewInst.HasAttribute("V_description") == true )
    {
      //Notify ("Description found")

      //Gets the attribute "Description" of the view. It gets the view type.
      Set ViewType = currentViewInst.GetAttributeString("V_description")
      //Notify ("Type of view : #", ViewType)   
    }
    
    Let pattern(String)
    Set pattern = (".*" + ViewType + "$")
    //Notify ( "Pattern : #", pattern)
      
    Let NameOfSymbolToDisplay(string)
    set NameOfSymbolToDisplay = ""
    
    //Search in the list of all symbol names if a name ends with the view type
    Let name(String)
    for name inside ListSymbolNames
    {
      //Notify ("Symbol name : #", name)
      if (name.MatchPattern(pattern) == true) 
      {
        //Notify ("MatchPattern")
        set NameOfSymbolToDisplay = name
        break
      }    
    }

    //Notify ( "Name of symbol to display : #", NameOfSymbolToDisplay )   

    //Sets the output parameter "Symbol_Name"
    Parameters.SetAttributeString("Symbol_Name", NameOfSymbolToDisplay)
  }

}