ZOS API: says the coating is None in the API, but OpticStudio says there is a coating

  • 9 March 2021
  • 1 reply
  • 70 views

Userlevel 2

In the API, I make some checks on the ZMX file before running simulations. One of the checks is that at least face 0 has a coating. The API tells me there is no coating, but I can see in OpticStudio that there is a coating.



Here is the object in OpticStudio:





And the coating from the API:





I'm certain I have the right object - why is the coating incorrect in the API? How can I check for the existence of coatings on face 0? Right now I'm using face_data.Coating not in {'None', 'NULL'}.


1 reply

Userlevel 6
Badge +2

Hi Chris,


This is strange. The only time I've seen this type of problem is if there was an error in opening the file. When that's the case, 'Object 6' would not exist, since a standard (blank) lens file only has one object. Are you sure the file you are trying to edit has opened in the API? Also, can you send me your definition for object_row?


I have tested in Python and Matlab and was able to get the code to work by using these commands:


 













Matlab Python
    TheSystem = TheApplication.PrimarySystem;

    TheNCE = TheSystem.NCE;

    obj3 = TheNCE.GetObjectAt(3);

    

    obj3_face0 = obj3.CoatScatterData.GetFaceData(0);

    char(obj3_face0.Coating)
TheNCE = TheSystem.NCE



obj3 = TheNCE.GetObjectAt(3)

obj3_face0 = obj3.CoatScatterData.GetFaceData(0).Coating

print(obj3_face0)

 


I tested in OpticStudio 21.1.1 using Interactive Extensions for both languages to connect to our Even Asphere.zmx sample. Can you use the code I provided to test in your own environment? I recommend testing with Interactive first to be sure you are applying the checks/changes to the correct file. Then move into Standalone when you have confirmed the code works. 


Let me know if you have any questions about this!


Best,


Allie

Reply