Solved

MATLAB reload zemax file

  • 4 October 2021
  • 2 replies
  • 141 views

Userlevel 1

Hello,

I was wondering, if there is a ways using the API to reload the zemax file to its default.

Every single time, I am using the API, I need to start a new instance of OpticStudio. However, it would be nice, to simply reload the file, that I am working on, in order to save some time.

 

Is there a way to do something like this?

 

icon

Best answer by David.Nguyen 6 October 2021, 11:44

View original

2 replies

Userlevel 7
Badge +2

Hi Nils,

 

I’m not sure that’s what you meant, but you can save your file right after starting the API:

TheSystem.SaveAs(path)

And then once you want to reset your file, just load it again:

TheSystem.LoadFile(path, false)

Be wary that the second parameter of the LoadFile method is set to false, it corresponds to the saveIfNeeded flag. If this flag is set to true, it saves your file before loading the new file (hence overwritting it).

Let me know if that answers your question.

Take care,

 

David

Userlevel 1

Thank you! That was exactly, what I was looking for.

Reply