Question

Filter String in Macro

  • 2 May 2024
  • 1 reply
  • 13 views

  • Single Emitter
  • 0 replies

I am rather new in the field of creating Macro. 

I am trying in a Macro to introduce a Ray tracing. I need to select the ray that I want to display. This function is done with Filter String is the normal use of Zemax. I could i use a filter string in the macro. Is there something special to carry. 


1 reply

Userlevel 7
Badge +2

@Sami 

 

As far as I know, the Filter String isn’t a setting that you can modify in ZPL. Depending on what you want to achieve, you could create a Source Ray to mimic the ray you are interested in and display this source only. Alternatively, the ZOS-API should let you edit the Filter String. This feature is described in Example 10 in all four supported languages (C++, C#, MATLAB, and Python):

# Open Detector Viewer, view previously saved .zrd file
DetectorView = TheSystem.Analyses.New_DetectorViewer()
DetectorView_Settings = DetectorView.GetSettings()
DetectorView_Settings.RayDatabaseFilename = "e10_API_Raytrace.ZRD"
DetectorView_Settings.ShowAs = ZOSAPI.Analysis.DetectorViewerShowAsTypes.FalseColor
DetectorView_Settings.Filter = "X_HIT(2, 4)" # Detector will only display rays which hit object 2 exactly 4 times
DetectorView.ApplyAndWaitForCompletion() # Apply Settings to Detector Viewer

This is the Python version.

I hope this helps and take care,

 

David

Reply