General InformationThis 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.
Input ObjectsInput objects must be of the following types:
Context Object Parameters
The three lists are synchronized. Sample 1The 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 2The 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 3The 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) | |||||||||||||||||||||||||||||||||||||||||||||||||