Option Explicit Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Declare Function GetTickCount Lib "kernel32.dll" () As Long Private myStep As Long Private counter As Long Private myShape As Circle2D Private Const TIMER_INTERVAL As Long = 50 Private Const NUMBER_OF_POINTS As Long = 200 Sub Main() ' get an active view Dim myView As DrawingView Set myView = CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView ' get a curve, first element is axis system Dim myCurve Set myCurve = myView.GeometricElements.Item(2) Dim startTime As Long startTime = GetTickCount myStep = 1 ' main timer loop Do If (GetTickCount - startTime) > TIMER_INTERVAL Then ' draw circle Draw myView, myCurve 'reset time after redrawing startTime = GetTickCount End If ' pause execution Sleep 5 ' process events (do not block UI) DoEvents Loop While True End Sub Sub Draw(myView As DrawingView, myCurve) Dim distanceRatio As Double distanceRatio = 1 / NUMBER_OF_POINTS * counter Dim paramExtents(1) myCurve.GetParamExtents paramExtents Dim param As Double param = paramExtents(0) + (paramExtents(1) - paramExtents(0)) * distanceRatio Dim currPoint(1) myCurve.GetPointAtParam param, currPoint Dim fact2D Set fact2D = myView.Factory2D If myShape Is Nothing Then Set myShape = fact2D.CreateClosedCircle(currPoint(0), currPoint(1), 5) Else myShape.SetData currPoint(0), currPoint(1), 5 End If If counter < 0 Or counter > NUMBER_OF_POINTS Then myStep = -myStep counter = counter + myStep End Sub