Navigation: Scripting Reference Manual > Functions & Subroutines > RedrawRayHistory

 

RedrawRayHistory

 

Contact Us: fredsupport@photonengr.com

 

Description

When an advanced raytrace has been performed using the ray history option, this command will redraw ray intersection history to the 3D view for all rays meeting the ray selection criteria supplied as an array of T_RAYFILTEROP data structures.  Note that this only redraws the ray history to the 3D view and does NOT replace or alter the rays that exist in the ray buffer.

 

 

Syntax

success = RedrawRayHistory( tRayFilterOp() )

 

 

Parameters

success (Boolean)

Returned boolean flag indicating whether ray history information was saved to the designated file (True) or failed to save (False).

 

tRayFilterOp() As T_RAYFILTEROP

An array of T_RAYFILTEROP data structures containing the set of ray filters whose criteria determine the set of ray's whose history is redrawn.

 

 

Example

The following example performs an advanced raytrace with raypaths and history enabled, searches the resulting path data for paths having intersected a surface of interest and constructs the corresponding array of T_RAYFILTEROP data structures, and then redraws the rays having intersected the surface of interest.

 

Sub Main

 

    DeleteRays()

    PathDeleteAll()

 

    'Raytrace with ray history and raytrace paths enabled

    Dim rayCnt As Long

    Dim adv As T_ADVANCEDRAYTRACE

    InitAdvancedRaytrace( adv )

        adv.rayHistory = True

        adv.rayPaths = True

        adv.draw = False

    rayCnt = AdvancedRaytrace( adv )

 

    'Search raytrace path output for paths intersecting a surface of interest

    'and build up the array of ray selection criteria

    Dim tRayFilterOp() As T_RAYFILTEROP

    Dim surfOfInterest As Long, curPath As Long, curEvent As Long, pathsFound As Long

    surfOfInterest = FindFullName( "Geometry.Optics.Zoned Optic.Center" )

    pathsFound = 0

    For curPath = 0 To PathCount()-1

        For curEvent = 0 To PathEventCount(curPath)-1

            If PathEventItemID( curPath, curEvent ) = surfOfInterest Then

                If pathsFound = 0 Then

                    ReDim tRayFilterOp(0)

                    tRayFilterOp(0).datum = curPath

                    tRayFilterOp(0).combineCode = 1 'OR

                    tRayFilterOp(0).opCode = 22 'Rays on path#

                Else

                    ReDim Preserve tRayFilterOp( UBound( tRayFilterOp, 1 )+1 )

                    tRayFilterOp( UBound(tRayFilterOp,1) ).datum = curPath

                    tRayFilterOp( UBound(tRayFilterOp,1) ).combineCode = 1 'OR

                    tRayFilterOp( UBound(tRayFilterOp,1) ).opCode = 22 'Rays on path#

                End If

                pathsFound = pathsFound + 1

                Exit For

            End If

        Next curEvent

    Next curPath

    Print pathsFound & " paths were found containing surface of interest."

    Print "Path List: "

    For curPath = 0 To UBound( tRayFilterOp, 1 )

        Print Chr(9) & tRayFilterOp(curPath).datum

    Next curPath

 

    'Apply ray filter and redraw ray history

    Dim success As Boolean

    success = RedrawRayHistory( tRayFilterOp )

 

End Sub

 

See Also

Basic Ray Data Commands

T_RAYFILTEROP

 

 

 

 

 

Copyright © Photon Engineering, LLC