Circle curve division

In this post we make a variation of a curve division by max spacing, to generate division points and axes along a circle curve in three ways: by angle, instances and angle-instances. This spacing can be particularly useful as a more flexible polar assembly pattern.
The circular division is displayed using an action and a reaction, but the logic can also be captured with a knowledge pattern.
P.S this post was part of a series of posts realized for 3dxautomation.com that unfortunately was shouted down.

Tools — 3dExperience, EKL

Using an action

For each use of the action, all inputs and parameters need re-assignment.

Using an action

For each use of the action, all inputs and parameters need re-assignment.

//Declare variables
let crvLength (LENGTH)
let crv (Circle)
let srf (Surface)
let extPt, pt, ctPt, pjPt, ptDir(Point)
let tnLine, yLine, prjLine (Line)
let ptAxis (AxisSystem)
let normalDir, yDir, pjDir (Direction)
let count, i, instDiv (Integer)
let stRatio, addRadio, stAngle, divAngle (Real)
let ptName, axName, divType (String)
let delList, geoList (List)
let delItem(Feature)
let geoDest, geoPt, geoAx, geoItem (OpenBodyFeature)

//set the inputs
set crv = CircleCurve
set divType = DivisionType
set stAngle = StartAngle
set divAngle = AngleDivision
set instDiv = InstancesDivision
set geoDest = GeoDestination
set srf = ReferencePlane

//Clean the destination
geoList = geoDest.Query("OpenBodyFeature", "")
if geoList.Size() > 0
{
for geoItem inside geoList
{
delList = geoItem.Query("Feature", "")
if delList.Size() > 0
{
for delItem inside delList
{
delItem.Delete()
}
}
else
{
break
}
}
}

//Define the division values for each typology
if divType == "Angle"
{
count = floor(360/Angle)
stRatio = StartAngle/360
addRadio = Angle / 360
}
if divType == "Instances"
{
count = (Instances-1)
stRatio = 0
addRadio = 1 / Instances
}
if divType == "Angle&Instances"
{
count = (Instances-1)
stRatio = StartAngle/360
addRadio = Angle / 360
}

//Define the extremity point projecting the center point along Ydir
ctPt = center(crv)
ptDir = pointonsurface(srf, pt, direction(0mm, 1mm, 0mm), 1mm)
prjLine = line(ctPt, ptDir)
pjDir = direction(prjLine)
pjPt = project(ctPt, crv, pjDir)
crvLength = length(crv)

//Create the GeoSets to contain points and axes
geoPt = new("OpenBodyFeature", "Points", geoDest)
geoAx = new("OpenBodyFeature", "Axes", geoDest)

//Division creating points and axes
i = 0
for i while i <= count
{
ptName = "Pt-"+i
axName = "Ax-"+i
pt = new("Point", ptName, geoPt )
pt = pointoncurveRatio(crv, pjPt , stRatio, False)
tnLine = linetangent(crv, pt, 0mm, 1mm, False) //Axes will be tanget to the curve
normalDir = direction(tnLine)
yLine = line(pt, ctPt)
yDir = direction(yLine)
ptAxis = new("AxisSystem", axName, geoAx)
ptAxis = axisSystem(pt, normalDir, yDir)
stRatio = stRatio + addRadio
}
geoDest.Update()