Navigation: Scripting Reference Manual > Functions & Subroutines > PathFilteredPower

 

PathFilteredPower

 

Contact Us: fredsupport@photonengr.com

 

Description

This function retrieves the Filtered Power value from the specified raytrace path.

 

 

Syntax

power = PathFilteredPower( pathID )

 

 

Parameters

power (Double)

Returned Filtered Power value associated with pathID.

 

pathID As Long

Path number whose Filtered Power value is being returned.

 

 

Example

The following example performs an Advanced Raytrace with raytrace paths enabled, constructs a ray selection filter that isolates rays (a) ending on a detector surface and (b) on a path interacting with a specific surface of interest, applies the ray filter to the paths database, reports information to the output window about the applied filter and the filtered raytrace paths, and then restores the raytrace paths database to its unfiltered state.

 

Sub Main

          

    DeleteRays()

    PathDeleteAll()

    PrefsSetRandomReseed(True)

 

    'Perform the advanced raytrace with raytrace paths enabled

    Dim tAdv As T_ADVANCEDRAYTRACE

    InitAdvancedRaytrace( tAdv )

    tAdv.draw = False

    tAdv.rayHistory = True

    tAdv.rayPaths = True

    AdvancedRaytrace( tAdv )

 

    'Construct the ray selection filter to be applied to the path database

    Dim tFilter() As T_RAYFILTEROP

    ReDim tFilter(1)

    tFilter(0).opCode = 3 'ray on the specified surface

    tFilter(0).stringDatum = "Geometry.Detector.Surface"

    tFilter(1).opCode = 42 'ray on path including surface

    tFilter(1).stringDatum = "Geometry.Housing.Aperture.Notch.Surface"

    tFilter(1).combineCode = 0 'AND

    ApplyFilterToRayPaths( tFilter() )

 

    'Retrieve filtered paths that survived the ray filter operation

    Dim npaths As Long, pathIDs() As Long

    npaths = PathFilteredPaths( pathIDs(), True )

 

    'Report information to the output window

    Print "==================================="

    Print "Ray selection filter applied to ray paths:"

    PrintRayFilter( tFilter(), "", False )

    Print ""

    Print "Number of filtered paths = " & npaths

    Print "Paths returned by PathFilteredPaths() function"

    Print "Path ID" & Chr(9) & "Filtered Power" & Chr(9) & "Filtered Rays"

    Dim curpath As Long, ppower As Double, praycount As Long

    For Each curpath In pathIDs()

        ppower    = PathFilteredPower( curpath )

        praycount = PathFilteredRayCount( curpath )

 

        Print curpath;

        Print ppower;

        Print praycount

 

    Next

 

    'Restore the raytrace paths database to its unfiltered state

    Erase tFilter()

    ReDim tFilter(0)

    tFilter(0).opCode = 0

    ApplyFilterToRayPaths( tFilter() )

 

End Sub

 

See Also

GetRayFilter

Basic Ray Data Commands

T_RAYFILTEROP

Path Commands

ApplyFilterToRayPaths

PathFilteredPaths

PathFilteredRayCount

 

 

 

 

 

Copyright © Photon Engineering, LLC