Compute Position of Branch Segment in Support (EHIRouting_ComputeUVAddSegmentToSupport)

An opening ID is an entry point used to customize business logic. The Compute position of branch segment in support opening ID allows you to well-arrange the segment positions in the support section, based on the already routed segments (U, V arrangement values).

This opening ID is available in the Electrical physical system design resources resource set and computes the position of a branch inside a support while routing the branch to the support instance.

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 triggered when a support to be added is selected in the branch routing.

The table below provides you with information related to the definition of the Opening ID.

PLM Opening ID: EHIRouting_ComputeUVAddSegmentToSupports
Customization intent: Computation
Execution context:Client

Input Objects

Input objects must be of the following types:

  • ThisObject: Branch segment to route.
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter NameTypeRead/WriteComments
SupportInstanceVPMInstance ReadInstance of support to be added in branch's route.

Its reference has a SharedSupportPart type.

SupportSectionIntegerReadSupport section number
IsCalledDuringAutoArrangment Boolean Read Returns the name of the command which triggers the opening ID.

To use this parameter, a boolean variable needs to be declared and a value needs to be assigned to the variable.

For example, to be notified if the opening ID is triggered while using the Auto Arrange Segments command, the business rule syntax is the following:

let ibIsAutoArrangeSegmentCommand(BOOLEAN)
set ibIsAutoArrangeSegmentCommand = Parameters.GetAttributeBoolean("IsCalledDuringAutoArrangment")

ListOfSegmentsListReadList of already routed segments in the support's section.

Objects of Segment type.

ListOfSegmentsUListRead/WriteList of already routed segments position (U) with regards to support entry point and plane.

Objects of Length type.

ListOfSegmentsVListRead/WriteList of already routed segments position (V) with regards to support entry point and plane.

Objects of Length type.

RoutedBranchULengthWriteU position of the branch relative to the support section origin.
RoutedBranchVLengthWriteV position of the branch relative to the support section origin.

The three lists are synchronized. ListOfSegmentsU and ListOfSegmentsV can be edited in the business rule itself by the user written script. Then it is reused in the segment routing algorithm to re-arrange the already routed segments. The U and V value for the segment to be routed is still returned via the RoutedBranchU and RoutedBranchV output arguments of the business rule.

Sample 1

The following sample illustrates the business rule syntax in the context of auto-arranging segments to be routed.

/* CATRule signature (do not edit) : (ThisObject : #In Segment, Parameters
  : #In RuleContext) : #Void */

let Support(VPMInstance)
let listU(LIST)
let listV(LIST)
let ListBranches(LIST)
let UOut(REAL)
let VOut(REAL)
let ValueU(REAL)
let ValueV(REAL)
let NbBranch(INTEGER)
let NbU(INTEGER)
let NbV(INTEGER)
let SupportSection(INTEGER)

UOut = 0.0
VOut = 0.0
Parameters.Severity = 1
Parameters.Message = "Could not compute U and V - use default 0.0 & 0.0"

set Support = Parameters.GetAttributeObject("SupportInstance")
set ListBranches = Parameters.GetAttributeObject("ListOfSegments")
set SupportSection = Parameters.GetAttributeInteger("SupportSection")
set listU = Parameters.GetAttributeObject("ListOfsegmentsU")
set listV = Parameters.GetAttributeObject("ListOfsegmentsV")

NbBranch = ListBranches->Size()
NbU = listU->Size()
NbV = listV->Size()

Trace(1, "Validating addition of Support to branch " + ThisObject.Name + "Support 
 = " + Support.PLM_ExternalID + "--> Section ",SupportSection)
Trace(1, "Numbers - Branch = " + NbBranch + "     Branch U = " + NbU + "    
 Branch V = " + NbV)

if((NbU <> NbBranch) OR (NbV <> NbBranch))
{
   Parameters.Severity = 2
   Parameters.Message = "Could not compute U and V - Since input list are invalid"	
}
else
{
   if(NbU == 0) /* Any branch has not be routed through the support*/
   {
      UOut = 0.0
      VOut = 0.0
   }
   else
   {
      set ValueU = listU->GetItem(NbU)
      set UOut = ValueU + 20
   }
}

Parameters.SetAttributeReal("RoutedBranchU", UOut)
Parameters.SetAttributeReal("RoutedBranchV", VOut)

Sample 2

The following syntax illustrates the business rule syntax in the context of auto-arranging segments to be routed.

/* CATRule signature (do not edit) : (ThisObject : #In Segment, Parameters : #In RuleContext, Validation : #Out Boolean) : #Void */

let Support(VPMInstance)
let currentSeg (Segment)
let listU(LIST)
let listV(LIST)
let ListOfSegments(LIST)
let UOut(REAL)
let VOut(REAL)
let ValueU(REAL)
let ValueV(REAL)
let nbSegments(INTEGER)
let nbSegmentU(INTEGER)
let nbSegmentV(INTEGER)
let SupportSection(INTEGER)
let index (INTEGER)
let sSptName (STRING)
let diameter (REAL)
let thisdiameter (REAL)
let lastU (REAL)
let lastV (REAL)

thisdiameter = ThisObject.Elec_Diameter/1.0mm
UOut = 0.0
VOut = 0.0
Parameters.Severity = 1
Parameters.Message = "Could not compute U and V - use default 0.0 & 0.0"

set Support = Parameters.GetAttributeObject("SupportInstance")
set ListOfSegments = Parameters.GetAttributeObject("ListOfSegments")
set SupportSection = Parameters.GetAttributeInteger("SupportSection")
set listU = Parameters.GetAttributeObject("ListOfSegmentsU")
set listV = Parameters.GetAttributeObject("ListOfSegmentsV")

nbSegments = ListOfSegments->Size()
nbSegmentU = listU->Size()
nbSegmentV = listV->Size()

Trace(1, "Validating addition of Support to branch " + ThisObject.Name + "Support = " + Support.PLM_ExternalID + "--> Section ",SupportSection)
Trace(1, "Numbers - Branch = " + nbSegments + "     Branch U = " + nbSegmentU + "    Branch V = " + nbSegmentV)

if((nbSegmentU <> nbSegments) OR (nbSegmentV <> nbSegments))
{
	Parameters.Severity = 2
	Parameters.Message = "Could not compute U and V - Since input list are invalid"	
}
else if (NULL <> Support)/* the input lists are synchornized, so start computing the UV */
{
	set sSptName = Support.PLM_ExternalID
	if( (sSptName == "SupportUVTest.1") and (1 == SupportSection) )
	{
		/* Support section 1 is a Rectangle with dimension 100mmx50mm */
		if(0 >= nbSegments) /* No segments are routed from this section */
		{
			UOut = -50 + thisdiameter/2.0
			VOut = -25 + thisdiameter/2.0
		}
		else /* some segments are already routed */
		{
			lastU  = -50
			lastV  = -25
			index = 1
			for index while index <= nbSegments
			{
				set currentSeg = ListOfSegments->GetItem(index)
				if(NULL <> currentSeg)
				{
					diameter = currentSeg.Elec_Diameter/1.0mm
					ValueU = listU->GetItem(index)
					ValueV = listV->GetItem(index)
					UOut = lastU + diameter/2.0
					VOut = lastV + diameter/2.0
					if( (abs(UOut - ValueU) >= 0.001) or (abs(VOut - ValueV) >= 0.001) )
					{
						listU->SetItem(UOut, index)
						listV->SetItem(VOut, index)
					}
				}
			}
			UOut = UOut + diameter/2.0
			VOut = VOut + diameter/2.0
		}
	}
}

Parameters.SetAttributeReal("RoutedBranchU", UOut)
Parameters.SetAttributeReal("RoutedBranchV", VOut)
Parameters.SetAttributeObject("ListOfSegmentsU", listU)
Parameters.SetAttributeObject("ListOfSegmentsV", listV)

Sample 3

The following sample illustrates how to automatically arrange the segments routed inside a support while using the Auto Arrange Segments command.

For more information, see Electrical 3D Design User's Guide: Arranging Segments: Arranging Segments in Supports Automatically.

/* CATRule signature (do not edit) : (ThisObject : #In Segment, Parameters : #In RuleContext, Validation : #Out Boolean) : #Void */

let Support(VPMInstance)
let currentSeg (Segment)
let listU(LIST)
let listV(LIST)
let ListOfSegments(LIST)
let UOut(REAL)
let VOut(REAL)
let ValueU(REAL)
let ValueV(REAL)
let nbSegments(INTEGER)
let nbSegmentU(INTEGER)
let nbSegmentV(INTEGER)
let SupportSection(INTEGER)
let index (INTEGER)
let sSptName (STRING)
let diameter (REAL)
let totalDiameter (REAL)
let lastU (REAL)
let lastV (REAL)
let ThisU(REAL)
let ThisV(REAL)

UOut = 0.0
VOut = 0.0
Parameters.Severity = 1
Parameters.Message = "Could not compute U and V - use default 0.0 & 0.0"

set Support = Parameters.GetAttributeObject("SupportInstance")
set ListOfSegments = Parameters.GetAttributeObject("ListOfSegments")
set SupportSection = Parameters.GetAttributeInteger("SupportSection")
set listU = Parameters.GetAttributeObject("ListOfSegmentsU")
set listV = Parameters.GetAttributeObject("ListOfSegmentsV")
set ThisU = Parameters.GetAttributeReal("RoutedBranchU")
set ThisV = Parameters.GetAttributeReal("RoutedBranchV")

totalDiameter = 0mm
nbSegments = ListOfSegments->Size()
nbSegmentU = listU->Size()
nbSegmentV = listV->Size()

Trace(1, "Validating arrangement of branch segments in Support: "+ Support.PLM_ExternalID )
Trace(1, "Numbers - Branch = " + nbSegments + "     Branch U = " + nbSegmentU + "    Branch V = " + nbSegmentV)

if((nbSegmentU <> nbSegments) OR (nbSegmentV <> nbSegments))
{
	Parameters.Severity = 2
	Parameters.Message = "Could not compute U and V - Since input list are invalid"	
}
else if (NULL <> Support)/* the input lists are synchronized, so start computing the UV */
{
	// Compute sum of segment diameters 
	index = 1
	for index while index <= nbSegments
	{
		set currentSeg = ListOfSegments->GetItem(index)
		if(NULL <> currentSeg)
		{
			diameter = currentSeg.Elec_Diameter/1mm
			totalDiameter = totalDiameter + diameter + 2
			Notify ("total cur", totalDiameter)
		}
	}
	
	// Arrange segments in support
	Notify ("total cur", totalDiameter)
	lastV = totalDiameter / 2.0
	Notify ("LastV", lastV)
	index = 1
	for index while index <= nbSegments
	{
		set currentSeg = ListOfSegments->GetItem(index)
		if(NULL <> currentSeg)
		{
			diameter = currentSeg.Elec_Diameter/1.0mm
			ValueU = 0.0
			ValueV = lastV - diameter/2.0
			Notify ("ValueV ", ValueV)
			listU->SetItem(ValueU, index)
			listV->SetItem(ValueV, index)
			lastV = lastV - diameter - 2
		}
	}
}
Parameters.SetAttributeObject("ListOfSegmentsU", listU)
Parameters.SetAttributeObject("ListOfSegmentsV", listV)