Skip to main content

Hello,

 

I am working on a macro as described in the following article, but converted in Python:

https://support.zemax.com/hc/en-us/articles/1500005579082-Modeling-Rotationally-Symmetric-Irregularity-RSI-with-the-API

As working directly on the system, each modification saves an UNDO file and the action is repeated for each Zernike coefficient, for each surfaces, that slows down the execution.

The actual way :

Get the system with :

TheSystem = TheApplication.PrimarySystem

and work on it directly

 

I tried to get a copy of the system with the CopySystem function, modify the copy and push it back :

TheSystem = TheApplication.PrimarySystem

new_system = TheSystem.CopySystem()

# does work here

TheSystem = new_system.CopySystem()

 

When looking at the surface type of TheSystem, I can see that it changed correctly, however it is not applied in the Zemax main window.

I used the TheSystem.UpdateStatus() function, but does not help.

 

Ideally my goal would be to be able to make all modifications outside of Zemax and update it when done, and hence get only one step of UNDO.

 

Is it possible in Python ? If so, what did I missed ?

 

Would that be possible in C# ?

 

Thank you for your help.

@Sebastien G. 

 

Its not available through the ZOSAPI (AFAIK), but you can disable the UNDO feature by changing: Setup..OpticStudio Preferences..General..Undo to None.

Then you can save the file at whichever stage of your design you want in the ZOSAPI.

I hope this helps and take care,

 

David


Hello,

thank you for your reply.

 

Yes I looked at this solution, but it is also not possible to change it programmatically, so I am not very keen to use it, as it is possible to forget to change it back.

 

There might be a solution to save a special .cfg and to load it at the beginning of the script and to reload the intial .cfg,  but I have not tried it yet.

 


Reply