Question

Are "Update" and "Reset zoom" acesible via ZOS-API?

  • 28 November 2023
  • 4 replies
  • 46 views

Userlevel 1

Hi,
i wonder if for analysis window it would be possible to ask for “Update” or “Reset zoom” via ZOS-API.
As if clicking on the buttons on the picture bellow.

 

 


4 replies

Userlevel 3
Badge

Hi @dgeorgiev!

If you retain the analysis object (e.g. as Draw3DAnalysis), you can update the analysis using Draw3DAnalysis.Apply(). You can find an example here: https://zospy.readthedocs.io/en/latest/examples/Escudero-Sanz%20eye%20model/Escudero-Sanz%20eye%20model.html#Redo-these-calculations-for-light-at-a-different-eccentricity

Alternatively, if this is the only open analysis window, you can run:

TheOpticalSystem.Analyses.Get_AnalysisAtIndex(1).Apply()

If there are more open analysis window, you can still do something similar, but you need to somehow find out which index belongs to the 3D layout analysis.

As far as I know, the “Reset zoom” functionality is not accessible through the API; unfortunately, none of the settings for the 3D layout are available through the API, either.

Userlevel 1

Thank you @chaasjes  !

It is infortunately sad, if there is no chance to reset the zoom from API.

I hoped to load .zos file and add some surfaces in .connect_as_extension() mode.

In this case .Apply() works but with the old wrong zoom and i can not see the progress.

 

Hopefylly there is may be another solution from Zemax?

Userlevel 6
Badge +2

Hi Dimiter,

In a post earlier this month, a engineer at Zemax posted that in the 2024 R1 release of Ansys OpticStudio, ZOS-API support for all 5 layout plots (3 sequential, 2 non-sequential) will be available.  They mentioned all the settings, along with export resolution (Setup > Project Preferences > Graphics > Default Export Resolution) and some toolbar settings (camera view, line thickness) will be available.  

The Camera View should be Isometric, X-Y, Y-Z, and X-Z.  When you manually click on these camera views, the zoom is automatically reset.  This will reset your camera rotation (I’m not sure if you’ll be able to rotate or zoom via the ZOS-API).  

Unfortunately, Zemax took this post down so hopefully they are still planning on releasing this feature in 2024 R1.  If they took it down, they might need more testing which means the release might get pushed back...if this is the case, reach out to your account manager and urge them to include Layout Support for the ZOS-API.

Userlevel 1

Hi @MichaelH, @chaasjes 

your help is appreciated!

It is good to know what is (not) possible.

Thank you for saving me the time for useless search.

To see the progress of my script was a nice to have, if not much time investment is required.

Reply