Dear Zemax Community,
When I try to use the BatchRayTrace tool from Python in an Interactive Extension, I get a RemotingException, which seem to be related to the use of the AddRay method in the IRayTraceNormUnpolData interface.
To reproduce the issue, try making Example 23 into an Interactive Extension (instead of a Standalone Application). Alternatively, this is my code snippet for an Interactive Extension:
from System import Enum, Int32, Double # Open the BatchRayTrace tool MyBatchRT = TheSystem.Tools.OpenBatchRayTrace() # Add an unpolarized-raytrace ToImageSurface = 3 MaxRays = 1 MyUnpolRT = MyBatchRT.CreateNormUnpol(MaxRays, ZOSAPI.Tools.RayTrace.RaysType.Real, ToImageSurface) WaveNumber = Int32(0) Hx = Double(0) Hy = Double(0) Px = Double(0) Py = Double(0) MyUnpolRT.AddRay(WaveNumber, Hx, Hy, Px, Py, Enum.Parse(ZOSAPI.Tools.RayTrace.OPDMode, 'None')) # Run the raytrace MyBatchRT.RunAndWaitForCompletion() # Close the BatchRayTrace tool MyBatchRT.Close()
Let me know if you have the same problem, and if you've found a solution to this, or if I'm missing something.
Thanks for your help, and take care,
David