Change Scatter Function Viewer settings with ZOS-API

  • 25 November 2020
  • 4 replies
  • 96 views

Hello,


I am currently programming a ZOS-API application to estimate the Minimum Relative Ray Intensity. Here I would like to open the 'Scatter Function Viewer', adjust my scatter model and everything else to get a rough lower estimate of my reflection by the total power. Unfortunately I could not change the settings by myself with the help of the ZOS-API Help and further attempts and hope for an answer here.  

My code is structured as follows:



I program in Python, which makes the syntax very similar to Matlab and I can use it without problems.




With kind regards




Christian


4 replies

Userlevel 6
Badge +2

Hi Christian,


The Scatter Function Viewer does not yet have settings which can be edited through the API. We can confirm this with the property HasAnalysisSpecificSettings as is exemplified in the Knowledgebase article 'Basic method of performing system analysis in ZOS-API':


 



 


At this point, we have to look to a different method to update the Scatter Viewer settings. Usually, we would try to use the ModifySettings property. However, there are no ModifySettings types which correspond to the Scatter Function Viewer. We can confirm this by looking to the Help System file 'The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > MODIFYSETTINGS (keywords).'


With that in mind, you will need to create one (or several) CFG files to load with the Scatter Function Viewer in the API. You can generate a configuration file by opening the Scatter Function Viewer settings in the GUI. Then, update the settings and click Save. This will create or update a file 'SFV.CFG' in the Zemax\Configs folder. You can rename this file, save a few different settings files, and then load them into the API with the LoadSettings property.  


Let us know if you have any other questions about this!


Best,


Allie

 


Hello Allie,


I facing a problem in implementing the scattering on the surface in sequential mode. In Non-sequential mode, it is working very well. But in Nsequential mode, it is not showing any scattering. How can I implement scattering (trying to use a diffuser) in sequential mode?.


Another problem I am facing in saving the text file window using the macro. I am using a loop to save the file with a different name but it is not taking the file name as a variable rather it is taking it as a constant and overwriting the content, again and again, I am attaching the example please have look


for i,1,2,1

SAVEWINDOW 2, 'E:\faheem....\Textfile name(i).TXT

end.


Textfile name it is taking as name, not an array. Please help me out of this, I will be very thankful to you.


 


Best and Regards,

Faheem Ahmad

Userlevel 6
Badge +2

Hi Faheem,


In Sequential Mode, you can apply scattering through the Surface Properties...Scattering dialog. 


 



 


Keep in mind, in Sequential Mode the scattering is assumed to deviate the ray angle only very slightly. The primary effect is a 'blurring' of the spot diagram or ray pattern at the image surface. Sequential scattering is not intended for modeling the effects of back scatter, wide angle scatter (such as Lambertian) or other scatter where the scattered rays may not follow a well behaved sequential path to the image surface. 


Additionally, you will see no ray splitting in Sequential Mode. This mode demands that each ray trace sequentially through the system, surface-by-surface. The results you see on the Image plane and on the layout are the scattered rays. Which, again, should not deviate very far from the nominal path in Sequential Mode. 


For your second question, you need to convert the iterator i to a string and then add the strings together. An example would be this:


 


FOR i, 1, 2, 1

     iter = $STR(i)

     filename = 'E:\Faheem...\Textfilename(' + iter + ').TXT'

     GETTEXTFILE filename, 

NEXT

 


In general, if you are trying to save the Text window, I would recommend using GETTEXTFILE instead of SAVEWINDOW. Here is some information on that:


 



 


Best,


Allie


 

Hello Allie,


Thank you so much for your kind response, it helped me soo so much. 


For the scattering in sequential mode, I am following the steps as you have suggested. Actually, I am trying to implement the direction tuning film (DTF10) from LUMINIT website to tilt the beam at 1o degrees. There is no change in the beam direction on the image plane, I am using the footprint and the spot diagram to analyse the DTF. I need to analyse both diffusers as well as DTF in the sequential mode but what I am doing is not helping. Can you please suggest me something more in detail? I will be very thankful to you.


Best and Regards,

Faheem Ahmad

Reply