Tracing one source at a time

When using the GUI to trace one source at a time, you have to toggle the traceability state of the sources, so that one source remains traceable. To avoid this modification to the model, you can use the following script. 

First, use the CreateSource command to create the rays at the selected source. 

Then, use the TraceExisting (or TraceExistingDraw) command to trace the rays that already exist in the ray buffer.

    For i = 0 To GetEntityCount() - 1
        If IsSource(i) Then

            'this creates the rays at only this source
            CreateSource i

            Print "tracing " & GetName(i)
            TraceExisting

            'Calculation
            IrradianceToARN(anaId, arnName, arnNode)

            'Etc.

        End If
    Next i<br>

The code above loops over all "entities" in the model (the combined contents of the Optical Sources, Geometry, and the Analysis Surface(s) folders), and for each source that creates the rayset and traces.

Still need help? Contact Us Contact Us