General InformationThis opening ID is invoked when a new symbol or route is placed in a diagram view using one of the following commands:
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.
Input ObjectsInput objects must be of the following types:
Context Object Parameters
Main and Called Representations ManagementIn 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 RepresentationTo 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)
}
}
| |||||||||||||||||||||||||||||||||||||||||||