Batch raytracing of nonsequential files

  • 1 October 2020
  • 1 reply
  • 50 views

I would like to run batch raytracing of several nonsequential files. How can I automatically do that? Is there a way to open .zmx file within ZPL? Any other way? Batch file should do a sequence: open .zmx file, run raytrace,exit raytrace, save detector view as bmp, close file, open next .zmx file... Thank you.


1 reply

Userlevel 6
Badge +2

Hi Marko,

 

You can definitely utilize ZPL to perform this type of analysis. The keyword LOADLENS can be used to open a lens file. Then you can run a ray trace with the keyword NSTR and save the Detector Viewer window with the keyword EXPORTJPG or EXPORTBMP. We have a full description of all of these keywords in the Help System file 'The Programming Tab > About the ZPL > KEYWORDS (about the zpl).' 

 

 

For guidance on how to write a loop which cycles through multiple files, check out the Knowledgebase article 'How to open consecutively-named lens files using a ZPL macro.' In particular, Method #1 will let you cycle through all ZMX files in a particular directory. 

 

 

I have written a quick example to help get you started. This will open the Even Asphere file from the Non-Sequential samples directory. Then, a ray trace will be run, a Detector Viewer will be opened, and the output will be saved to the same directory as the lens file. Note that the keywords EXPORTBMP and EXPORTJPG will save the image of the Detector Viewer with the same resolution that is shown on your screen. 

 

 

Let me know if you have any questions about this!

 

 

Best,

 

 

Allie

 

Reply