Solved

Looking for a Command line type inquiry

  • 29 March 2023
  • 6 replies
  • 159 views

Userlevel 1
Badge

If I have a complex multi lens system, and I am trying to verify a few parameters,  of a single element, is it possible to “evaluate” or ping certain Zemax parameters directly ? 

 

For example if i wish to to confirm the EFL of element #3,  spanning surfaces 6-7.   

Is there anything like a single command :   EVA  EFLY  or EFLA  S6-7   ?? 

 

[Mod note: moved to more appropriate forum for OS-related discussions.] 

 

icon

Best answer by MichaelH 30 March 2023, 00:08

View original

6 replies

Userlevel 6
Badge +2

Hi James,

This looks like you are trying to find similar functionality to CodeV’s Command Line Interface.  Unfortunately, Zemax was built around the GUI first (circa 1991) and then implemented a robust API second (circa 2014, although the DDE existed in limited form since the early 2000’s).  CodeV being written in the 1960’s was primarily developed around the CLI first and then built a GUI later.

So most of the interactions with OpticStudio will be with the keyboard & mouse; there is no direct CLI to type in a one-line command.  You can automate simply repetitive tasks with a Zemax Programming Language (ZPL) macro or more complex calculations with a ZOS-API script, but each of these programs would need to be called with a mouse click to execute.  

To evaluate a system, the main interaction will with the Merit Function Editor (MFE).  There are over 400+ operands that can be used to both optimize a system and report back the current performance of that system.  To consider an operand for optimization, make the Weight a non-zero value but to use the operand as a reporting value, simply keep the Weight as 0.  To get the Effective Focal Length between S6-7, you should use:

EFLY 1 1 (you can also use EFLX for anamorphic systems)

 

Userlevel 1
Badge

Dear Michael: 

Thank you for taking the time to answer.   I like your idea of using MCE operands, unweighted, to do a quick evaluation.   I think that will be perfect for now.    I also spent a brief bit of time looking at the intro to ZPL, but i don’t think that is warranted for what i have in mind.   Thanks again for your insights and time.   

  • James 

 

Userlevel 7
Badge +3

Hey James,

If you look under Programming…Extensions you’ll find the Command Line Interface:

Written by one of Zemax’s finest, this extension lets you pass DDE commands one at a time and get responses back before issuing the next one.

Really though, using the UI, the Universal plot, or ZPL is far superior 😁 Also remember the use of sliders to vary any cell’s value. You can have as many sliders open at one time as you can manage.

Userlevel 7
Badge +3

Re-reading this, a Universal plot should do exactly what you want. Set up whatever parameter scan you want, and plot EFLY Surface_a, Surface_b and the job’s a good’un.

 

  • Mark
Userlevel 6
Badge +2

Hey Mark, just a heads up, the Extension List was removed last year from OpticStudio (I believe starting with Ansys Zemax OpticStudio 2022 R2.0) so the latest version doesn’t have Command Line Interface or Refresh List; this last removal is really annoying since if you create/download/install a new User Extension, you have to restart the entire OpticStudio to show the User Extension in the dropdown.  So rather than working forward and adding the ability to refresh the User Analysis list, Zemax took a step backwards and removed useful functionality.  I already reported this as a bug but it was refiled as a “feature request” (which we all know what that means...it will never be added back).

Userlevel 7
Badge +3

Hmmm….I used the version from Dec 21 2022, as my screenshot shows. But I have the ‘old’ Zemax licensing, not the shiny new Ansys licensing.

Reply