Skip to main content

An example of tracing 2 rays by using the following method.

OpenBatchRayTrace

Here is a code snippet that traces single ray twice and read ray data
 

from System import Enum,Int32, Double

toSurf=10max_rays=2int_val=Int32(1)
double_val=Double(1)
type_format==int_val,int_val,int_val,double_val,double_val,double_val,double_val,double_val,double_val,
double_val,double_val,double_val,double_val,double_val]

raytrace2 = TheSystem.Tools.OpenBatchRayTrace();
RayTraceData = raytrace2.CreateNormUnpol(max_rays, Enum.Parse(ZOSAPI.Tools.RayTrace.RaysType, "Real"), toSurf);
RayTraceData.AddRay(2, 0.0, 0.1, 0.0, 0.0, Enum.Parse(ZOSAPI.Tools.RayTrace.OPDMode, "None"))
RayTraceData.AddRay(2, 0.0, 0.0, 0.0, 0.0, Enum.Parse(ZOSAPI.Tools.RayTrace.OPDMode, "None"))
raytrace2.RunAndWaitForCompletion()
RayTraceData.StartReadingResults()
RayTraceData.StartReadingResults()
ray_data1=RayTraceData.ReadNextResult(*type_format)
ray_data2=RayTraceData.ReadNextResult(*type_format)
X1_surf10=ray_data114]
Y1_surf10=ray_data115]

X2_surf10=ray_data224]
Y2_surf10=ray_data225]
raytrace2.Close()

 
For results, please check the ZOS-API syntax help file to determine the meaning of each index.
Note that ray_data1a0] is the returned boolean value that indicates whether the ray was successfully traced.

 


Reply