Quick adjust in ZPL MACRO

  • 3 December 2021
  • 3 replies


When using a ZPL macro, is there the possibility of using a keyword that function like quickadjust?


There is the keyword QUICKFOCUS but it works only on the last surface thickness


Best answer by David.Nguyen 6 December 2021, 11:38

View original

3 replies

Userlevel 7
Badge +2

Dear Nicolò,


To the best of my knowledge, there isn’t such a keyword readily available. However, I can think of two workarounds.

First, you can reproduce the Quick Adjust feature in ZPL. There is one limitation (described below), but this allows you to stick with the ZPL langage. Here’s an example of what could be done:

# Edit surface:
adjust_surface = 3

# Edit parameter (0: Radius | 1: Thickness):
parameter = 1

# Edit criterion (1: Spot Size Radial | 2: Spot Size X Only
#                   3: Spot Size Y Only)
criterion = 1

# Edit evaluation surface:
eval_surface = 4

# Save Merit Function
SAVEMERIT "temporary.MF"

# Clear Merit Function

# Setup Default Merit Function
DEFAULTMERIT 0, criterion, 0, 1, 3, 6, 1, -1, 0, -1, 1, 1, 0

# Clear variables

# Setup variable
IF (parameter == 0)
    SOLVETYPE adjust_surface, CV, 1, 1, 1, 1
    SOLVETYPE adjust_surface, TV, 1, 1, 1, 1

# Optimize

# Update

# Clear Merit Function

# Load Merit Function
LOADMERIT "temporary.MF"

# Clear variables

In the screenshots below, I’m illustrating the macro behaviour (before/after) on a dummy file:

Before running the macro
After running the macro

The main limitation is that you can’t seem to generate an angular Default Merit Function.

Second, the Quick Adjust feature is available through the ZOS-API. So, you may want to switch from ZPL to ZOS-API for your application. See the ZOS-API Syntax Help excerpt below:

Let me know if this helps, and take care,



Thank you for the detailed and complete answer! I was hoping there was a way of doing it without touching the Merit function, but this method works as expected

Userlevel 7
Badge +2

Hi Nicolò,


Sorry I wasn’t clear, this is not a limitation of ZPL. You can save the Merit funciton before and load it again once the quick adjust is done with the keywords SAVEMERIT and LOADMERIT, I will update my answer with the proper lines of codes for you to try. You could even think about using DELETEFILE to remove the temporary file.

Let me know if it works for you.

Take care,