ZOS-API equivalents for ZPL numeric function SURC(A$) and MAXF()

  • 30 March 2020
  • 0 replies
  • 68 views

Userlevel 4
Badge +2
The following code can be used as (MATLAB) ZOS-API equivalents for ZPL numeric function SURC and MAXF:

 

surf=0;
while(surf<TheSystem.LDE.NumberOfSurfaces)
if(TheSystem.LDE.GetSurfaceAt(surf).Comment=="TEST")
surc=surf;
break
end
surf=surf+1;
end




max_field = -1E9;
for i = 1:TheSystem.SystemData.Fields.NumberOfFields
X_field= TheSystem.SystemData.Fields.GetField(i).X;
Y_field= TheSystem.SystemData.Fields.GetField(i).Y;
radial_field= sqrt(X_field^2+Y_field^2);
if (radial_field> max_field)
max_field = radial_field; max_field_num=i;
end
end
fprintf('%d %f\n',max_field_num,max_field);





 

0 replies

Be the first to reply!

Reply