Skip to main content

Question: 



I'm trying to use the API to connect to OpticStudio. I'm using the default template script to establish a connection. When I run the script, I get an error message "License Check Failed" or "License is not valid for ZOSAPI use".   



Answer:



There are a couple of things that can lead to this error. Firstly, please ensure you have either a Professional or Premium OpticStudio License (a requirement for using the API). The next step depends on if you're running a Standalone Application, or an Interactive Extension:



If you're using a boilerplate template for a Standalone Application, the most probable cause of this error is that you already have 2 instances of OpticStudio running. The perpetual OpticStudio license limits the number of active instances of the application to 2. The Standalone Application attempts to open a new instance of OpticStudio and then connect to it; if you already have 2 instances running, and you then try to run the Standalone Application API script, this will attempt to launch a 3rd instance. The license forbids this, so the script will return a license check error.



If you're using a boilerplate template for an Interactive Extension, the most likely cause of this error is that the application isn't in 'listen' mode. Before connecting to an already-open instance of ZOS via an Interactive Extension, you have to tell the application to await connection from the API. This simple button-push is important for establishing the connection. In the instance of ZOS to which you want to connect, click The Programming Tab > Interactive Extension. You'll see a window pop up saying "waiting for connection...". Now you're ready to run the API script.




Reply