Description This command sets the document state to a current configuration and returns a boolean indicating success/failure.
Syntax cSuccess = SetCurrentConfig( configIndex )
Parameters cSuccess (Boolean) Returned boolean indicating whether the configuration was successfully applied to the document (True) or not (False).
configIndex As Long Index of the configuration state which should be applied to the document.
Example The following example loops over all configurations and performs an image analysis for each configuration state. In this example, a detector entity is located at the focal plane of the zoom lens and is setup to auto-create an analysis results node at the conclusion of each raytrace.
Sub Main
'Prepare the document ClearOutputWindow ARNDeleteAllNodes() Print "Beginning zoom imaging simulation..."
'Retrieve the number of configurations in the document Dim cCount As Long cCount = GetConfigCount() Print "There are " & cCount & " configurations in the document."
'Loop over configurations Dim curConfig As Long Dim cSuccess As Boolean For curConfig = 0 To cCount-1
'Set the configuration state Print "Tracing configuration " & curConfig cSuccess = SetCurrentConfig( curConfig ) If Not cSuccess Then Print "Failed to set configuration " & curConfig Else 'Trace the source EnableTextPrinting False DeleteRays TraceCreate() EnableTextPrinting True End If
Next curConfig EnableTextPrinting False DeleteRays EnableTextPrinting True
'Loop over ARNs and display in the visualization view Dim curARN As Long Dim dSuccess As Boolean For curARN = 0 To ARNGetNodeCount() If ARNIsValidNode( curARN ) Then dSuccess = ARNDisplayInVisualizationView( curARN, "" ) If Not dSuccess Then Print "Failed to display ARN " & curARN End If End If Next curARN
End Sub
See Also
|