Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
ListOfNewAngle | Angle |
Write | - |
Sample
The following sample describes how to compute an arrangement of segments when arranging junctions.
/* CATRule signature (do not edit) : (ThisObject : #In Segment, Parameters : #In RuleContext) : #Void */
// variables declaration
let ListOfSeg(LIST)
let ListOfNewAngles(LIST)
let ListOfOriginalAngles(LIST)
let index(INTEGER)
let NbSegToArrange(INTEGER)
let Angle(REAL)
// variables initialization
set ListOfSeg= Parameters->GetAttributeObject("ListOfSegment")
set ListOfOriginalAngles= Parameters->GetAttributeObject("ListOfOriginalAngle")
set NbSegToArrange = ListOfSeg->Size()
// parametrization of the angle
// NOTE: the angle is with respect to the reference segment (biggest diameter or longest one)
Angle = (PI)/(NbSegToArrange+1)
index = 1
// set angle value for each segment of the junction to arrange
for index while index <= NbSegToArrange
{
ListOfNewAngles->SetItem((PI/2)+(Angle*index),index)
}
// return the list of angles to the Prepare Layout app
set ListOfNewAngles = Parameters->SetAttributeObject("ListOfNewAngle", ListOfNewAngles)