Context Object Parameters
Parameter Name | Type | Read or Write | Input or Output | Comments |
---|
FactType | Any EKL type | — | | Type of ThisObject in the business rule body. |
SourceSegmentProfile | ElecProfile |
Read only | Input | Profile defined on the segment selected for the arrangement. |
List_TargetSegments | LIST(Segments) | Read only | Input | List of all secondary segments targeted in the arrangement. |
List_TargetSegmentsProfiles | LIST (ElecProfile) | Read only | Input | List of profiles of the segments targeted in the arrangement. |
List_TargetSegmentsXOffset | LIST (LENGTH) | Read/Write | Input/Output | List of current x-offset values of the secondary segments targeted in the arrangement. |
List_TargetSegmentsYOffset | LIST (LENGTH) | Read/Write | Input/Output | List of current y-offset values of the secondary segments targeted in the arrangement. |
List_NewSegmentsIndices | LIST (Int) | Read only | Input | List of indices of the new segments added at the junction and listed in List_TargetSegments and in List_TargetSegmentsProfiles .
|
Sample
The following sample illustrates how to automatically position and arrange segments at a branch junction.
let ParentProfile(ElecProfile)
let ChildProfile(ElecProfile)
let ListChildProfile(List)
let ListCurrentxOffset(List)
let ListCurrentyOffset(List)
let ListComputedxOffset(List)
let ListComputedyOffset(List)
let ListChildSegs(List)
let ListCompSegs(List)
let Base(length)
let Height(length)
let HIncr(length)
let nbH(Integer)
let VIncr(length)
let nbV(Integer)
let childBase(length)
let childHeight(length)
let index1(Integer)
let index2(Integer)
let pos(Integer)
let dxpos(length)
let dypos(length)
let segBr(Feature)
let maxH(length)
let CurrX(length)
let CurrY(length)
let XTolereance(length)
let YTolereance(length)
let ParentRectProfile(ElecRectangularProfile)
let ChildRectProfile(ElecRectangularProfile)
let ChildCircleProfile(ElecCircularProfile)
let ChildEllipseProfile(ElecEllipticalProfile)
let ChildTruncProfile(ElecTruncatedRectangularProfile)
let ChildSegment(Segment)
set ListChildSegs = Parameters.GetAttributeObject("List_AllTargetSegments")
set ListChildProfile = Parameters.GetAttributeObject("List_ProfilesOfAllTargetSegments")
set ListCurrentxOffset = Parameters.GetAttributeObject("List_CurrentxOffset")
set ListCurrentyOffset = Parameters.GetAttributeObject("List_CurrentyOffset")
set ParentProfile = Parameters.GetAttributeObject("SourceProfile")
set ListComputedxOffset=Parameters.GetAttributeObject("List_ComputedxOffset")
set ListComputedyOffset=Parameters.GetAttributeObject("List_ComputedyOffset")
set ListCompSegs=Parameters.GetAttributeObject("List_ComputedTargetSegments")
Notify("Running Business Rule")
set ParentRectProfile = ParentProfile
if NULL<>ListChildProfile
{
Notify("ChildProfileNon-Null")
if (NULL<>ParentRectProfile)
{
Notify("ParentProfileNon-Null")
set Base = ParentRectProfile.Elec_Width
set Height = ParentRectProfile.Elec_Height
set CurrX=-1 * (ParentRectProfile.Elec_Width/2)
set CurrY=-1 * (ParentRectProfile.Elec_Height/2)
set XTolereance = 3mm
set YTolereance = 3mm
Notify("XCurr :", CurrX)
index1 = 1
pos=1
for index1 while index1 <= ListChildProfile->Size()
{
set ChildRectProfile = ListChildProfile.GetItem(1)
set ChildCircleProfile = ListChildProfile.GetItem(1)
set ChildEllipseProfile = ListChildProfile.GetItem(1)
set ChildTruncProfile = ListChildProfile.GetItem(1)
if(NULL<>ChildRectProfile)
{
set childBase = ChildRectProfile.Elec_Width
set childHeight = ChildRectProfile.Elec_Height
Notify("CBase :", childBase)
}
else if NULL<>ChildCircleProfile
{
set childBase=ChildCircleProfile.Elec_Diameter
set childHeight = childBase
}
else if NULL<>ChildEllipseProfile
{
set childBase=ChildEllipseProfile.Elec_MajorAxis
set childHeight = ChildEllipseProfile.Elec_MinorAxis
}
else if NULL<>ChildTruncProfile
{
set childBase=ChildTruncProfile.Elec_MajorWidth
set childHeight = ChildTruncProfile.Elec_MajorHeight
}
pos = pos+1
if ((CurrX+childBase) >= (Base/2))
{
CurrX=-1 * (ParentRectProfile.Elec_Width/2)
CurrY=CurrY+maxH+YTolereance
maxH=0mm
}
Notify("ChildBase :",childBase )
if maxH < childHeight
{
maxH=childHeight
Notify("maxH :",maxH )
}
Notify("Index :",index1 )
set ChildSegment = ListChildSegs->GetItem(index1)
ListCompSegs->Append(ListChildSegs->GetItem(index1))
set segBr = ChildSegment.Owner
Notify("Branch :", segBr.Name)
set dxpos=CurrX+(childBase/2)
CurrX = CurrX+childBase+XTolereance
Notify("XCurr :", CurrX)
set dxpos=dxpos
set dypos=CurrY+(childHeight/2)
set dypos=dypos
ListComputedyOffset->Append(dypos)
ListComputedxOffset->Append(dxpos)
}
}
}
if ListCompSegs<>NULL
{
Parameters.SetAttributeObject("List_ComputedxOffset", ListComputedxOffset)
Parameters.SetAttributeObject("List_ComputedyOffset", ListComputedyOffset)
Parameters.SetAttributeObject("List_ComputedTargetSegments", ListCompSegs)
//Parameters.SetAttributeObject("L2PPhysicalFather", PhyFather)
Parameters.SetAttributeInteger("Severity", 0)
Parameters.SetAttributeString("Message", "Equipment Father found through BR")
}
else
{
Parameters.SetAttributeInteger("Severity", 2)
Parameters.SetAttributeString("Message", "Equipment Father NOT found through BR")
//Notify("Equipment Father NOT found through BR: " + ThisObject.V_Name)
}