Skip to main content

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?

 

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


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


Reply