In OpticStudio interface, If the optical system has some error then just after opening we get the error messages in Zemax Error Message Box .As we can see in image below ,SK2 was excluded before user setting .
In ZOS-API, there are some methods under the ZOSAPI.IOpticalSystem Interface Reference that allows to zemax error messages:
The general workflow is to whatever operation will generate the message you need to call TheSystem.GetCurrentStatus() .It will show the status of your optical setup .
Here sample code for Matlab :
import ZOSAPI.*;
TheSystem = TheApplication.PrimarySystem;
sampleDir = TheApplication.SamplesDir;
testFile = System.String.Concat('C:\test\Double Gauss 28 degree field.zmx');
test = char(TheSystem.GetCurrentStatus())
Here’s sample code for Python :
# Insert Code Here
# Setup
testFile =r"C:\test\Double Gauss 28 degree field.zos"
TheSystem.LoadFile(testFile,False)
# To get the Error message
test = str(TheSystem.GetCurrentStatus())
print(test)
I create a connection with the Interactive Extension for Python and Matlab both .In this screenshot we can the Zemax Error Message displayed :
Sahil Rajan