Hi all,
I have been using ZOS-API Pythonnet to perform a ray trace and save the ray trace data as text files. The following program snippet worked perfectly fine up until a few months ago. Now, when I run the same code, it does the ray trace and saves the text file without changing any of the settings.
import ZOSAPI;
TheSystem = TheApplication.PrimarySystem;
teleFile=('T_file.zmx')
TheSystem.LoadFile(teleFile,False);
Systemdata=TheSystem.SystemData
TheAnalyses=TheSystem.Analyses;
X, Y = np.round(np.mgrid[(-1):(1):100j, (-1):(1):100j],3)
positions = np.vstack([X.ravel(), Y.ravel()])
pos=np.transpose(positions)
px=pos[:,0]
py=pos[:,1]
max_rays=len(px)
newWin=TheAnalyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.RayTrace);
newWin_Settings=newWin.GetSettings();
Field_1 = Systemdata.Fields.GetField(1)
Field_1.X=0
Field_1.Y=0
path='\RT_trial'
for i in range(max_rays):
newWin_Settings.Px=pxpi];
newWin_Settings.Py=pyyi];
#newWin_Settings.Wavelength.SetWavelengthNumber(1);
#newWin_Settings.Field.SetFieldNumber(1);
newWin_Settings.Type=ZOSAPI.Analysis.Settings.Aberrations.RayTraceType.DirectionCosines;
newWin.ApplyAndWaitForCompletion();
newWin_Results=newWin.GetResults();
file_name=path+'ray_'+str(i)+'.txt'
newWin_Results.GetTextFile(file_name)
The Px and Py =0 for all the rays in the text files. Does anyone know what the issue could be?