Ansys Learning Forum Forums Discuss Simulation Optics I am new to use MATLAB ZOS-API and struggling to execute this file. Reply To: I am new to use MATLAB ZOS-API and struggling to execute this file.

Niki Papachristou
Ansys Employee

Hi Navaneeth,

Thank you for reaching out to us! 

This message typically means that the NSCRayTrace tool is no longer open or that you have another tool open already. I would assume that the tool hasn't closed based on the code that you shared. Therefore, I suspect it might be another tool that is open. You can only have one tool open at a time, so it is worth double checking that all other preceding tools have been closed.
 
One quick test would be calling the code below. If test is None, then that would confirm that another tool is not already open. Otherwise, the code will return the current tool name. 
 

test = TheSystem.Tools.CurrenTool

 
There can also be an issue with other tools running asynchronously. If you call Run() on a previous tool, that tool might still be running in the background (or did not properly close). Instead, it might be easier to manage execution by using RunAndWaitForCompletion() for all tools you call. This can also get tricky if you are calling many tools within loops.

Kind Regards,

Niki