Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
Angle | Angle |
Write | - |
Sample
The following sample describes how to compute the minimum allowable angle value when rotating segments.
/* CATRule signature (do not edit) : (ThisObject : #In Segment, Parameters : #In RuleContext) : #Void */
// variables declaration
let MinimumRotateAngle(ANGLE)
let ConsecutiveSegment(Segment)
let SegmentBranch(Branch)
let ThisSegment(Segment)
let ThisSegmentDiameter(LENGTH)
let NextSegmentDiameter(LENGTH)
// variables initialization
set MinimumRotateAngle = 20deg
// retrieve the consecutive segment to compare with the segment under rotation
ConsecutiveSegment = Parameters.GetAttributeObject("Segment2")
// retrieve the segment branch
set SegmentBranch = ConsecutiveSegment.Owner
// retrieve the diameter of the segment under rotation
set ThisSegment=ThisObject
ThisSegmentDiameter = ThisSegment.Elec_Diameter
// retrieve the diameter of the consecutive segment
NextSegmentDiameter = ConsecutiveSegment.Elec_Diameter
// set minimum angle value as per the segment path and diameter
if ( NextSegmentDiameter<=ThisSegmentDiameter )
Parameters.SetAttributeReal("Angle", MinimumRotateAngle)
else
{
set MinimumRotateAngle = 30deg
Parameters.SetAttributeReal("Angle", MinimumRotateAngle)
Notify("Diameter=#",NextSegmentDiameter)
}