- Home
- Programming ZEMAX
- ZPL
- How To Update and Change the Settings of a Graphic Window from ZPL
How To Update and Change the Settings of a Graphic Window from ZPL
Writing and Executing the Macro
In this example, let’s change the Z rotation parameter of the Shaded Model settings within the macro language. For each incremental change in Z, we can export a screen shot of the updated window.
The syntax for the MODIFYSETTINGS keyword is as follows:
MODIFYSETTINGS settingsfilename, type, value
The settingsfilename is the full path, name and extension of the configuration file to be modified.
The type argument is a text mnemonic that indicates which setting within the file is to be modified. See a complete list of available type codes in the ZEMAX User’s Guide. For the Shaded Model Z rotation, MODIFYSETTINGS keyword is SHA_ROTZ.
To increment the z rotation from 0 to 360 degrees, we will create a simple FOR loop:
After the MODIFYSETTINGS command within the FOR loop, the lens is reloaded without using the session file (see the docs on the LOADLENS keyword for details). The Shaded Model window is then updated. By reloading the lens file without the session file, the window is updated using the settings in our configuration file instead of the session file.
In this particular example, a total of 24 BMP files are created, each of which shows an incremental rotation about z. As a result, we can easily create an animation using these saved files. To learn more, click here!