General InformationThis opening ID is invoked during the routing process while selecting a port or a component.
Input ObjectsInput objects must be of the following types:
Context Object Parameters
Note:
The opening ID can be define to exclude some type of ports If the opening ID is not
attached to the Rule to Filter Logical Ports to Be Exposed resource,
all ports are exposed by default. If the opening ID is defined but fails, no ports are
exposed.
Exposing PortsThe folllowing rule checks whether the routable and component are from same system (internal connection) or from a different system (external connection). If it is an external connection, the Boolean is set as TRUE (in output list) only for the ports with name External_Port, else the Boolean is set as FALSE. Similarly, for an internal connection, the Boolean is set as FALSE (in output list) for all the ports with name External_Port else, the Boolean is set as TRUE. This means for internal connection that all the ports with External_Port as a name as are not valid.
//Get father occurrence of source object as input
let SourceFatherOccObject (LogicalOccurrence)
set SourceFatherOccObject = Parameters.GetAttributeObject ("Source_Father_Occ")
//Compute father reference of source object
let SourceFatherRefObject(RFLVPMLogicalReference)
set SourceFatherRefObject = SourceFatherOccObject.Reference
//Get occurrence of target object as input
let TargetOccObject(LogicalOccurrence)
set TargetOccObject = Parameters.GetAttributeObject ("Target_Object_Occ")
//Compute father occurrence of target object
let TargetFatherOccObject(LogicalOccurrence)
set TargetFatherOccObject = TargetOccObject.Owner
//Compute father reference of target object
let TargetFatherRefObject(RFLVPMLogicalReference)
set TargetFatherRefObject = TargetFatherOccObject.Reference
//Get list of ports of target object as input. This is the filtered list of ports of target object after doing basic compatibility checks for schematics
let PortListOfTarget(LIST)
set PortListOfTarget = Parameters.GetAttributeObject ("PortList_Target")
Let isize = 0
set isize = PortListOfTarget->Size()
Let j = 1
let OutputBooleanPortList(List)
//Loop over list of ports of target object
for j while j <= isize
{
let PortObject(RFLVPMLogicalPort)
set PortObject = PortListOfTarget->GetItem(j)
let PortName(String)
//Get attribute V_Name of the port
set PortName = PortObject.PLM_ExternalID
//Check if source and target are in same system
if (TargetFatherRefObject == SourceFatherRefObject) //Same system
{
//If V_Name matches with string “External_Port” Its an external port
if(PortName like '*External_Port*' )
{
OutputBooleanPortList.Append(FALSE)
}
//Its an internal port
else
{
OutputBooleanPortList.Append(TRUE)
}
}
//different system
else
{
//Its an external port
if(PortName like '*External_Port*')
{
OutputBooleanPortList.Append(TRUE)
}
//Its an internal port
else
{
OutputBooleanPortList.Append(FALSE)
}
}
}
Parameters.SetAttributeObject("List_Boolean_Ports", OutputBooleanPortList)
Authorized Port for the Connection with NozzleThe following example shows how to filter the ports of a component that is allowed to be connected to a nozzle.
Notify("Filter Ports rule start")
let SourceFatherOccObject (LogicalOccurrence)
set SourceFatherOccObject = Parameters.GetAttributeObject ("Source_Father_Occ")
//Compute father reference of source object
let SourceFatherRefObject(RFLVPMLogicalReference)
set SourceFatherRefObject = SourceFatherOccObject.Reference
//Get occurrence of target object as input
let TargetOccObject(LogicalOccurrence)
set TargetOccObject = Parameters.GetAttributeObject ("Target_Object_Occ")
//Compute father occurrence of target object
let TargetFatherOccObject(LogicalOccurrence)
set TargetFatherOccObject = TargetOccObject.Owner
//Compute father reference of target object
let TargetFatherRefObject(RFLVPMLogicalReference)
set TargetFatherRefObject = TargetFatherOccObject.Reference
let SourceNozzleRef(Piping_Logical_Nozzle)
set SourceNozzleRef = ThisObject
let TargetReference(EnsLogicalEquipment)
set TargetReference = TargetOccObject.Reference
if (NULL <> SourceNozzleRef) AND (NULL <> TargetReference)
{
// Use business logic for filtering ports while nozzle placement.
// We have strictly checked here if nozzle is being placed on equipment
//Get list of ports of target object as input. This is the filtered list of ports of target object after doing basic compatibility checks for schematics
let PortListOfTarget(LIST)
set PortListOfTarget = Parameters.GetAttributeObject ("PortList_Target")
Let isize = 0
set isize = PortListOfTarget->Size()
Let j = 1
let OutputBooleanPortList(List)
//Loop over list of ports of target object
for j while j <= isize
{
let PortObject(RFLVPMLogicalPort)
set PortObject = PortListOfTarget->GetItem(j)
let PortName(String)
//Get attribute V_Name of the port
set PortName = PortObject.PLM_ExternalID
let returnedIndex(integer)
returnedIndex = PortName.Search("PortForNozzle",0,true)
if(returnedIndex <> -1)
{
OutputBooleanPortList.Append(TRUE)
}
else
{
OutputBooleanPortList.Append(FALSE)
}
}
Notify("Nozzle placement logic")
Parameters.SetAttributeObject("List_Boolean_Ports", OutputBooleanPortList)
}
else
{
// Use business logic for fitering ports while routing.
Notify("Routing logic")
}
Notify("Filter Ports rule end")
In the sample rule above, the following logic is applied:
| |||||||||||||||||||||||||||||||||||||||