Here are a few samples to illustrate this business logic.
Shortcut Toolbar for Monoselection
To customize the shortcut toolbar, you must declare the file containing the script to be executed in
PLMBusinessLogicFLEditor.CATRuleExit:
<Script OpeningID="FL_BalloonCusto" Type="RFLPLMFunctionalInstance"
ScriptName="RFLP_BalloonCusto_FctInstance"/>
In this example, the script RFLP_BalloonCusto_FctInstance.CATRule is
executed each time a shortcut toolbar is requested on an object type
RFLPLMFunctionalInstance.
The script to customize shortcut toolbar commands in case of mono-selection is linked to the opening Id - FL_BalloonCusto. It is
available as long as a functional or
logical component is UI
activated.
The type indicated in the string Type=”” can be a ‘modeler’ type
(RFLPLMFunctionalInstance, RFLPLMFunctionalReference…) or a ‘customized’ type
(RFLPLMFunctionalInstanceDS, RFLPLMFunctionalReferenceDS for example).
The (modeler) types of object supported by this business logic for monoselection are:
- Function (reference and instance)
- Functional Flow Association
- Functional Connection
- Functional MUX/DEMUX
- Logical Component (reference and instance)
- Logical Port
- Logical Connection
- Logical MUX/DEMUX.
Shortcut Toolbar for Multiselection
The shortcut toolbar can also be customized for multiselection of functional or logical objects by using a
script identified by the OpeningID - FL_BalloonCustoMultiSel.
The "Type" attribute can be included to specify if the current UI active object is of the
given modeler/customization type. The "Type" value does not concern the selected objects
but only the UI active object.
<Script OpeningID="FL_BalloonCustoMultiSel" Type="RFLPLMFunctionalInstance"
ScriptName="RFLP_BalloonCusto_MultiSel"/>
In this example, the script RFLP_BalloonCusto_MultiSel.CATRule is executed to create a
shortcut toolbar on multiselection of components, only when an object of type RFLPLMFunctionalInstance
is currently UI activated.
The “Type” attribute can be omitted to have the script launched every time without
considering the type of the UI active object.
<Script OpeningID="FL_BalloonCustoMultiSel"
ScriptName="RFLP_BalloonCusto_MultiSel"/>
In this example, the script RFLP_BalloonCusto_MultiSel.CATRule is executed to create a
shortcut toolbar on multiselection of components, without considering the type of the current UI active
object.
Add Commands
Here is a script sample to add a new command.
let BalloonList(List)
let CurrentBalloonItem(List)
let CurrentCommand(String)
set BalloonList = Parameters->GetAttributeObject ("BalloonCmdList")
CurrentCommand = "CATPLMEditorInsertNewMuxRefCmdHdr"
CurrentBalloonItem.RemoveAll()
CurrentBalloonItem.Append(CurrentCommand)
BalloonList.Append(CurrentBalloonItem)
CurrentCommand = "CATPLMEditorInsertNewDemuxRefCmdHdr"
CurrentBalloonItem.RemoveAll()
CurrentBalloonItem.Append(CurrentCommand)
BalloonList.Append(CurrentBalloonItem)
Parameters->SetAttributeObject("BalloonCmdList", BalloonList)
Remove Standard Commands
Here is a script sample to remove standard new commands.
let BalloonList(List)
let CurrentBalloonItem(List)
let ItemSize(Integer)
let CurrentCommand(String)
let i(Integer)
set BalloonList = Parameters->GetAttributeObject ("BalloonCmdList")
i=BalloonList.Size()
for i while i>0
{set CurrentBalloonItem = BalloonList.GetItem(i)
set ItemSize = CurrentBalloonItem.Size()
if (ItemSize == 1)
{
set CurrentCommand = CurrentBalloonItem.GetItem(1)
if (CurrentCommand == "CATPLMEditorInsertNewLogPortCmdHdr")
{
BalloonList.RemoveItem(i)
i = i-1
}
Parameters->SetAttributeObject("BalloonCmdList", BalloonList)
Add New Commands in Second Level
The following sample creates a secondary level in a shortcut toolbar (one level only).
let BalloonList(List)
let CurrentCommand(String)
let BalloonCommandGroup(List)
set BalloonList = Parameters->GetAttributeObject ("BalloonCmdList")
CurrentCommand = "CATPLMEditorInsertNewMuxRefCmdHdr"
BalloonCommandGroup.Append(CurrentCommand)
CurrentCommand = "CATPLMEditorInsertNewDemuxRefCmdHdr"
BalloonCommandGroup.Append(CurrentCommand)
BalloonList.Append(BalloonCommandGroup)
Parameters->SetAttributeObject("BalloonCmdList", BalloonList)
Manage the Multiselection of Objects
Adding and removing commands in the shortcut toolbar for multiselection is similar to monoselection. Use the following script sample to
manage the multiple objects:
let SelectedObjectsList(List)
let i(Integer)
let CurrentObject(PLMEntity)
set SelectedObjectsList = Parameters->GetAttributeObject("SelectedObjects")
i= SelectedObjectsList.Size()
for i while i>0
{
set CurrentObject = SelectedObjectsList.GetItem(i)
if(CurrentObject->IsASortOf("RFLPLMFunctionalInstance") == TRUE){ […]
}
else if (CurrentObject->IsASortOf("RFLPLMFunctionalInstanceCusto1") == TRUE){
[…]
}
i = i-1
}