Skip to main content

When the analysis is finished in Zemax, how can I get a text file which including the outputs in 'Text' tab automatically? That means every time I run the model, I can get this text file at the same time. Thank you.



z14.png

Hi Jingran,



There are several ways you could do this.



If you feel comfortable, you could use the ZOS-API.



Otherwise, you can get away with a simple ZPL macro. Search for the keyword: GETTEXTFILE.



This is how you'd use it for the Wavefront Map for example:





GETTEXTFILE 'E:\MyWavefrontMap.txt', Wfm


Just change the path E:\MyWavefrontMap.txt, to wherever you want the file to be saved. Wfm is the string code for the Wavefront Map analysis.



Let me know if this helps.



Take care,



David


Perfect! I used your ZPL macro to solve my problem. It's really a powerful and convenient tool. Thank you very much!



 



Take care,



Jingran


I'm glad I was able to help.



If you want another pro tip. When you've run the macro once, it'll open a Text Viewer window. In this window, it is written Executing [path to your macro]. If you keep this window open, you can just double-click on it, and it'll execute again. So, whenever you need to refresh the Wavefront Map results, you just need to double-click on that window.



I hope this makes sense :p



Take care,



David


Hi David,



Thank you so much for your professional and detailed replies! It's very helpful to me.



 



Take care,



Jingran


Hi David,



We are using the python interface to ZOS-API and for some reason it is crashing out. To Debug we attempted to check the app opjects precense with the following: 



    logMessage('App Object Check: '+str(zos.TheApplication))



and it indicates correctly that the object exists:



     App Object Check: ZemaxUI.Common.ViewModels.ZOSAPI_Application



However immediatly after that call it crashes out with the following:



System.Runtime.Remoting.RemotingException: Object '/ef964475_20c0_44b1_b91a_d1be251d9e4c/yqd6tswp6jnufd1newpgn9sc_1.rem' has been disconnected or does not exist at the server.



Server stack trace: 


   at System.Runtime.Remoting.Channels.ChannelServices.CheckDisconnectedOrCreateWellKnownObject(IMessage msg)


   at System.Runtime.Remoting.Channels.ChannelServices.DispatchMessage(IServerChannelSinkStack sinkStack, IMessage msg, IMessage& replyMsg)



Exception rethrown at [0]: 


   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)


   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)


   at System.Object.ToString()


   at Python.Runtime.ClassBase.tp_str(IntPtr ob)



Have any ZOS-API users reported such behaviour? and if so are there any remedies or clues as to what might be happening?



Secondly, what is the ZOSAPI.APINetCallback for? and how can we use it? As I have a suspicion that it's related to the above crash, or could help solve it. I'm interested in using InitializeLifetimeService() however I did not see it in any examples provided. 



Your help would be greatly appreciated.



 



Take care,



Jingran


Hi Jingran,



You might want to create a separate post for that issue since its a different one. Also, you can mark my answer as a solution to your problem (if you think it solved your problem), such that people can refer to this post in the future.



This looks more like something for the people at Zemax, I don't work there, and don't have access to the source code.



However, if you could share an example, which demonstrates the crash. I could have a look at it.



Does that make sense?



Take care,



David


Hi Jingran and David,



Thanks David for the great replies.



I'll have a look at Jingran's new forum thread.



Sandrine


Hi David,



I have created a new forum thread. 



 



Sandrine,



I'm looking forward to your help.



 



Thank both of you!


Reply