Execution Triggered During Associate Junction Point Command (EWR_ExecuteJunctionAssociationAndRouteDispatch)

An opening ID is an entry point used to customize business logic. The Execution Triggered During Associate Junction Point Command opening ID allows you to automatically associate junction points with your electrical cables and dispatch the cable routes in your electrical physical systems.

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

This opening ID is invoked when you use the Associate Junction Points command. For more information, see Electrical 3D Design user's guide: Associating Junction Points with Cables.

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

Input Objects

Input objects must be of the following types:

  • ThisObject
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter Name Type Read or Write Comments
FactType VPMRootOccurence Type of ThisObject in the business rule body.
List_CableOccurence Elec3DCableOccurence

Sample

The following sample illustrates how to use this opening ID.

// SETUP 
/******************************************/

Let status(INTEGER)
Let Message(String)
Let RootContext(ProductOccurrence)
Let ListCableOccurrences(LIST)
Let nbCableOcc(Integer)
Let CableOcc(Elec3DCableOccurrence)
Let CableRef(Elec3DCable)
Let EPS_Cable(Electrical3DSystem)
Let EPS_A(Electrical3DSystemOccurrence)
Let EPS_B(Electrical3DSystemOccurrence)
Let EPS_C(Electrical3DSystemOccurrence)
Let Zone_Part_A(ProductOccurrence)
Let Zone_Part_B(ProductOccurrence)
Let Zone_Part_C(ProductOccurrence)
Let Zone_Part_A_Jn_Pt1(Elec3DJunctionPoint)
Let Zone_Part_B_Jn_Pt1(Elec3DJunctionPoint)
Let Zone_Part_C_Jn_Pt1(Elec3DJunctionPoint)
Let ToDevice(ProductOccurrence)
Let FromDevice(ProductOccurrence)
Let ToPort(Elec3DCavity)
Let FromPort(Elec3DCavity)
Let nbElecRoutes(Integer)
Let ListElecRoute(LIST)
Let ListElecRouteStatus(LIST)
Let ElecRoute_Cable(ElecRoute)
Let ElecRoute_1(ElecRoute)
Let ElecRoute_2(ElecRoute)
Let ElecRoute_3(ElecRoute)
Let ElecRoute(ElecRoute)
Let ListJnpartsFinal(LIST)
Let ListJnPointsFinal(LIST)
Let ListElecRoutesFinal(LIST)
Let ListElecRoutesStatusFinal(LIST)
Let ElecRoute_1_Dispatched(ElecRoute)
Let ElecRoute_2_Dispatched(ElecRoute)
Let ElecRoute_3_Dispatched(ElecRoute)
Let ElecRoute_4_Dispatched(ElecRoute)


/******************************************/
// EXECUTION 
/******************************************/
/* From ThisObject*/
Set RootContext = ThisObject

/* From Context Imput*/
Set ListCableOccurrences = Parameters.GetAttributeObject("List_CableOccurrence")
nbCableOcc = ListCableOccurrences.Size()

if (nbCableOcc > 0) Set CableOcc = ListCableOccurrences.GetItem(1)

if (CableOcc == NULL)
{
 Notify("No CableOccurrence Found.")
 exit
}

Set CableRef = CableOcc.Reference

if (CableRef == NULL)
{
 Notify("No CableReference Found.")
 exit
}

/* From the RootContext get the relevant EPS(s). */
Set EPS_A = RootContext->Access("PrdRootZone.1\Prd_Zone_A.1\EPS_A.1", "Electrical3DSystemOccurrence")
Set EPS_B = RootContext->Access("PrdRootZone.1\Prd_Zone_B.1\EPS_B.1", "Electrical3DSystemOccurrence")
Set EPS_C = RootContext->Access("PrdRootZone.1\Prd_Zone_C.1\EPS_C.1", "Electrical3DSystemOccurrence")

/* From the RootContext get the relevant Junction Device(s). */
Set Zone_Part_A = RootContext->Access("PrdRootZone.1\Prd_ZoneInterfaces.1\Zone_Part_A.1", "ProductOccurrence")
Set Zone_Part_B = RootContext->Access("PrdRootZone.1\Prd_ZoneInterfaces.1\Zone_Part_A.2", "ProductOccurrence")
Set Zone_Part_C = RootContext->Access("PrdRootZone.1\Prd_ZoneInterfaces.1\Zone_Part_A.3", "ProductOccurrence")


/* From CableRef */
status = CableRef.GetFrom(FromDevice, FromPort)
status = CableRef.GetTo(ToDevice, ToPort)
status = CableRef.ListOrderedRoutes(ListElecRoute, ListElecRouteStatus)
nbElecRoutes = ListElecRoute.Size()

if (nbElecRoutes <> 1)
{
 Notify("More/Less than one Route")
 exit
}
Set ElecRoute_Cable = ListElecRoute->GetItem(1)
if (ElecRoute_Cable == NULL)
{
 Notify("No ElecRoute_Cable Found.")
 exit
}


Let ListNetworkPathElements(LIST)
Let SizePathElems(Integer)
Let ListPaths(LIST)
Let szPaths(Integer)
Let RouteElec3DNetworkPath(Elec3DNetworkPath)
Let FromEnd(Elec3DConductorEnd)
Let ToEnd(Elec3DConductorEnd)
ElecRoute_Cable.GetPath(ListPaths, FromEnd, ToEnd)
szPaths = ListPaths.Size()

if (1 <> szPaths)
{
 Notify("ElecRoute not fully routed : " + szPaths)
 exit
}

Set RouteElec3DNetworkPath = ListPaths->GetItem(1)

if (NULL == RouteElec3DNetworkPath)
{
 Notify("Network path not found.")
 exit
}

RouteElec3DNetworkPath.ListNetworkPathElement(ListNetworkPathElements)
SizePathElems = ListNetworkPathElements.Size()

Let ListJnDeviceInNetwork(LIST)
Let ListJnPortInNetwork(LIST)
Let JnDeviceNetworkNode(Elec3DJunctionDeviceNode)
Let JnDeviceOccurrence(ProductOccurrence)
Let JnPort(VPMPort)
Let ListFeatures(LIST)
Let IndexPathElems(Integer)
IndexPathElems = 1


Notify("Size Path Elems: " + SizePathElems)

let PathElem(Feature)
for PathElem inside ListNetworkPathElements
{ 
	Set JnDeviceNetworkNode = PathElem

  if (NULL == JnDeviceNetworkNode)
  {
    continue
  }

  JnDeviceNetworkNode.GetComponents(JnDeviceOccurrence, JnPort, ListFeatures)
  
  if ((NULL == JnDeviceOccurrence) or (NULL == JnPort))
  {
    continue
  }
  
  Notify("Junction Node Added ")
  ListJnDeviceInNetwork.Append(JnDeviceOccurrence)
  ListJnPortInNetwork.Append(JnPort)
  
}

Let szJnsToAdd(Integer)
Let Junction_Device_InNetwork(ProductOccurrence)
Let Junction_Port_InNetwork(Elec3DJunctionPoint)
Let Index, IndexToAdd(Integer)
Index = 1
IndexToAdd = 0
szJnsToAdd = ListJnPortInNetwork.Size()


for Index  while Index <= szJnsToAdd
{ 
	Set Junction_Device_InNetwork = ListJnDeviceInNetwork->GetItem(Index)
  Set Junction_Port_InNetwork = ListJnPortInNetwork->GetItem(Index)
  if ((NULL == Junction_Device_InNetwork) or (NULL == Junction_Port_InNetwork))
  {
    Notify("Invalid Junction Part/Port found. skipping and continuing")
    continue
  }
  
  status = CableRef.AddJunctionDeviceAfterPosition(IndexToAdd, Junction_Device_InNetwork, Junction_Port_InNetwork)
  if (status > 0)
  {
    IndexToAdd = IndexToAdd + 1
    Notify("success : Junction Part/Port from network associated.")
  }
}


status = CableRef.ListOrderedJunctionDevices(ListJnpartsFinal, ListJnPointsFinal)
status = CableRef.ListOrderedRoutes(ListElecRoutesFinal, ListElecRoutesStatusFinal)

Let nbFinalJnParts(Integer)
Let nbFinalJnPoints(Integer)
Let nbFinalRoutes(Integer)
nbFinalJnParts = ListJnpartsFinal.Size()
nbFinalJnPoints = ListJnPointsFinal.Size()
nbFinalRoutes = ListElecRoutesFinal.Size()

if ((nbFinalJnPoints <> (nbFinalRoutes-1)) or (nbFinalJnPoints <> nbFinalJnParts))
{
 Notify("Process failed: DataModel Inconsistent")
 exit
}

Let Zone_ElecRoute(ElecRoute)
Let Zone_ElecRoute_Dispatched(ElecRoute)
Index = 1
for Index  while Index <= nbFinalJnPoints
{ 
	Set Junction_Device_InNetwork = ListJnpartsFinal->GetItem(Index)
  Set Junction_Port_InNetwork = ListJnPointsFinal->GetItem(Index)
  Set Zone_ElecRoute = ListElecRoutesFinal->GetItem(Index+1)
  if ((NULL == Junction_Device_InNetwork) or (NULL == Junction_Port_InNetwork) or (NULL == Zone_ElecRoute))
  {
    Notify("Invalid Junction Part/Port found. skipping and continuing")
    continue
  }

  if (Zone_Part_A == Junction_Device_InNetwork)
  {
    status = CableRef.DispatchRouteToEPS(Zone_ElecRoute, EPS_A, Zone_ElecRoute_Dispatched)
  }

  if (Zone_Part_B == Junction_Device_InNetwork)
  {
    status = CableRef.DispatchRouteToEPS(Zone_ElecRoute, EPS_B, Zone_ElecRoute_Dispatched)
  }
  
  if (Zone_Part_C == Junction_Device_InNetwork)
  {
    status = CableRef.DispatchRouteToEPS(Zone_ElecRoute, EPS_C, Zone_ElecRoute_Dispatched)
  }
  
}


Notify("Process Complete")