Skip to main content

ZPL commands for sensitivity analysis

  • September 30, 2020
  • 2 replies
  • 272 views

I’m interested in automating a couple of simple steps using ZPL. I don’t find a reference table of the names of different parameters in ZPL in the Help.

 

How do I print a particular merit function result e.g. CENX at a particular station, and how do I change the value of a Coordinate Break’s “Decenter X” or “Tilt X” etc.?

2 replies

Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • September 30, 2020

Hi Minosha,

Commands in the ZPL are split into two general groups: functions (commands which GET data) and keywords (commands which SET data). All ZPL commands are provided in the Help System file 'The Programming Tab > About the ZPL' which is found under the Programming tab:

 

 

For extracting Merit Function data, you will use a Numeric Function. There are a few options you could use here:

  1. For the full Merit Function value: MFCN()
  2. For the value of a particular operand: OCOD and OPEV or OPEW. These are discussed in detail in the KBA 'How to obtain the value for any optimization operand in a ZPL macro using OPEV and OPEW.'

To change the value of a parameter of a surface, you will use a Keyword. In this case, you will use the keyword SETSURFACEPROPERTY aka SURP. This keyword accepts a few inputs:

 

 

In the Help System file 'The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > SETSURFACEPROPERTY, SURP' we see that the code for a particular parameter value is '10:'

 

 

Knowing that Decenter X is parameter #1 for a Coordinate Break, the command to alter the Decenter X of surface #5 so that it is equal to -8 will be:

 

SURP 5, 10, -8, 1

 

I recommend utilizing that About the ZPL Help System file as it includes detailed information about all keywords and functions!

Best,

Allie


Mark.Nicholson
Luminary
Forum|alt.badge.img+3

It might be that the Tolerancing Script is more helpful to you than ZPL if you want to automate tolerancing.