ZOS-API Python set ZPL Macro solve

  • 3 April 2021
  • 1 reply
  • 111 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


 


1 reply

Userlevel 6
Badge +2

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