UDOC with automatic double pass calculation like GPIM?


I am attempting to write a User defined operand that calculates reflections off of optical elements.


I have been told by someone else very knowledgeable in these sorts of things that the GPIM operand does something similar, in that it “hacks” a double pass calculation in OpticStudio without actually requiring the user to have a double pass system set up.


I would like to be able to do the same thing in my user defined operand, but am unsure how to do it like GPIM does it. Would it be possible for somebody to shed some light on how to “hack” a double pass computation like GPIM, and if it is even possible to do through the zos-api syntax?


Thanks!


2 replies

Userlevel 7
Badge +3

Hey Jacob,


There's no hack, I'm afraid. What GPIM does it makes a copy of the lens, makes it a double-pass system (we now have the Make Double Pass Tool for this, although GPIM predates this tool), does whatever anaysis is needed on the modified file, and then throws away the modified file and returns whatever data is needed.


In principle you could do all this with your own C-code but it is much easier if you use a ZOS-API based operand. The basic approach though, im summary is:


1. Make a copy of the lens and only work on the copy. Do not make any changes to the version held in OS


2. Do whatever you want to the copy and extract whatever data you need


3. Throw away the copy when you're done.


- Mark

Userlevel 6
Badge +2

Hi Jacob


As Mark said, I think that ZOS-API User-Operand would definitely help as you can call the Make Double Pass Tool.

Your code may look like this:


int NbSurfaces = TheApplication.PrimarySystem.LDE.NumberOfSurfaces;

ghostFile = new String[NbSurfaces];

            int i = 0;

            do

            {

                ghostFile[i] = System.IO.Path.Combine(FileFolder, string.Format('GH{000}000.zmx', i + 1));

                //TheApplication.PrimarySystem.LDE.RunTool_MakeDoublePass(int reflectAtSurface)

                TheSystem.LDE.RunTool_MakeDoublePass(i);

                TheSystem.SaveAs(ghostFile[i]);

                TheSystem.LoadFile(TempFile, false);

                i++;

            } while ((i < NbSurfaces));

Sandrine

Reply