Now, my finding is that I can use flag value 0. Then the settings from the Huigens PSF window are saved with the 'save' button from this window in the file lensfilename.cfg.
However, the same settings seem to be *additionally* saved in the file ....\Documents\Zemax\Configs\HPS.GFG.
This doubling confuses me. However, the subsequent execution of GETTEXTFILE with flag = 0 seems to use these settings (from one of these two files). Right?
Hi Christoph,
1. Which settings are used if no settingsfile is given at all? It seems that in this case the settings that are saved with the 'save' button in the 'Huygens PSF' window are used. Is this correct and always the case? Does it additionally depend on the 'flag' setting?
When you use GETTEXTFILE without explicitly stating the settings file, then the settings used will be the same ones that are shown when you open a fresh instance of the analysis tool in question. Those initial settings are pulled from the lens-specific configuration file (lensfilename.cfg) if available. Otherwise, the settings are pulled from the {Zemax}\Configs folder.
When you click the 'Save' button, then both the lens-specific CFG and the configuration file found in the {Zemax}\Configs folder will be updated with the new settings. GETTEXTFILE will then use those updated settings.
With regards to the 'Flag' setting - I personally never use this, but it will choose the settings based on the method as described in the Help System file 'The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > GETTEXTFILE (keywords)'.
In general, the process I use is this:
- Open the analysis window I want to use for GETTEXTFILE
- Update the settings and click 'Save'. This will generate (or update) a lens-specific configuration file. All analyses and GETTEXTFILE will default to this file now.
- Run the macro with GETTEXTFILE. It will use the most-recently saved settings.
- For any other updates to the settings beyond that, use the keyword MODIFYSETTINGS to change the settings in the lens-specific CFG
2. With flag=2 the settings box for the requested feature should be displayed. This doesn't seem to happen. No setting box appears. Or is this only the case in combination with an explicit settingsfile? I tryed w/o settingsfile.
I discussed this with one of our developers. This functionality may have been available in Z13, but is no longer available as part of OpticStudio. I have submitted a request to update the Help System with this information. I apologize for the confusion here.
3. How can I make sure that the current settings in the 'Huygens PSF' window are used for the simulation?
The most straight-forward method would be to open the analysis tool you're interested in, update the settings, and click 'Save'. Then GETTEXTFILE will use those settings.
4. Settings are saved to two different locations. Why?
Two CFG files are updated in order to maintain distinct settings for each project you are working on. Consider this following scenario:
You are working on Lens1.ZMX. You are interested in the Phase-output for the Huygen’s PSF. You change the settings and you click “Save”. This updates HPS.CFG and Lens1.CFG.
Now, you create a new lens file. You name it Lens2.ZMX. When you open a Huygen’s PSF for this fresh file, it will defer to the settings in HPS.CFG. However, let’s say you are interested in Type = Linear for this file’s PSF instead of Phase. You update the settings and you click “Save”. Now, Lens2.CFG is created, and HPS.CFG is updated.
The lens-specific CFG file will always take precedence. This way, if you return to Lens1.ZMX and open a new Huygen’s plot, it will still show the Phase output. Any new lens files which do not have a lens-specific CFG will then defer to HPS.CFG.
Let me know if you have any other questions about this!
Best,
Allie