I am writing a macro in .zpl. My goal is to define an array of rays in non-sequential mode, whereby each ray has a very specific starting position and direction. I want to trace each ray and save the information about each ray in a .txt file. Above all I am interested in saving the x,y,z-coordinates of the individual ray intercept with the last (detector) surface after the ray went has been reflected my multiple surfaces. Information like it is provided in the .ZRD-file. However I would like to get access to this information with .zpl and zos-api commands, because I need this information for a multitude of rays. In the end I want to have an x- and a y-coordinate for each ray written into the same .txt file.
Until now I have defined the following single ray direction.
FOR yTilt, -yT0/2, yT0/2, step_y # scan
FOR zTilt, -zT0/2, zT0/2, step_z # start,
SETNSCPOSITION 1, 5, 5, yTilt
SETNSCPOSITION 1, 5, 4, zTilt
NSTR 1, 6, 1, 0, 1, 0, 1, "saverays.ZRD", "", 0 # start non-sequential ray trac
NEXT zTilt
NEXT yTilt
How do I get access to the results of each raytrace performed in the two FOR-loops? Do I have to save a .ZRD-file for each one and get the information from there? Is there a easier way? I know that there are .zpl-commands for the sequential mode. However, I need the coordinates of intercept for the pure non-sequential mode, because the optics involve many CAD surfaces.
Best answer by David Nguyen
View original