Skip to main content

ZOS-API Python set ZPL Macro solve

  • April 2, 2021
  • 1 reply
  • 132 views

Hi,

I would like to generate a Zemax file with Pythonstandalone mode and going to set  a  ZPL Macro solve in cell (lens x position) .

After reading help document of ZOS20.3.2 and try to find syntax of this operation, I still don't know how to write this code to input ZPL Macro name.

May I have a simple sample code?

thanks

 

kevin

 

Did this topic help you find an answer to your question?

1 reply

Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 338 replies
  • April 5, 2021

Hi Kevin,

The syntax for setting a ZPL Macro solve looks like the following:

 

    surf5 = TheLDE.GetSurfaceAt(5)
    macroSolve = surf5.RadiusCell.CreateSolveType(ZOSAPI.Editors.SolveType.ZPLMacro)
    macroSolve._S_ZPLMacro.Macro = 'Test'
    surf5.RadiusCell.SetSolveData(macroSolve)

 

Note that the string is just the name of the macro - the extension and path name is not included. 

Just like in the GUI, the ZPL Macro solve has some limitations. For example, the macro will have different syntax depending on if you intend to place the solve before or after the STOP. You can read more about this in the Help System file 'The Programming Tab > About the ZPL > Using ZPL Macro Solves.'

Let us know if you have any other questions about this!

All the best,

Allie

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings