Created
May 10, 2021 14:26
-
-
Save Omnistic/4543693496f48214696b746861b48286 to your computer and use it in GitHub Desktop.
ZOS-API: Single raytrace example (results saved to a text file, not fully implemented)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a RayTrace analysis | |
MyRayTrace = TheSystem.Analyses.New_RayTrace() | |
# Check the settings implementation status of this analysis feature in the ZOSAPI | |
print('Does RayTrace have fully-implemented settings?', MyRayTrace.HasAnalysisSpecificSettings) | |
# Retrieve the settings | |
MyRayTraceSettings = MyRayTrace.GetSettings() | |
# Define the settings (or the ray to be traced) | |
MyRayTraceSettings.Field.SetFieldNumber(0) | |
MyRayTraceSettings.Wavelength.SetWavelengthNumber(0) | |
MyRayTraceSettings.UseGlobal = False | |
MyRayTraceSettings.Hx = 0 | |
MyRayTraceSettings.Hy = 0 | |
MyRayTraceSettings.Px = 0 | |
MyRayTraceSettings.Py = 1 | |
MyRayTraceSettings.Type = ZOSAPI.Analysis.Settings.Aberrations.RayTraceType.DirectionCosines | |
# Run the RayTrace with the new settings | |
MyRayTrace.ApplyAndWaitForCompletion() | |
# Retrieve the results | |
MyRayTraceResults = MyRayTrace.GetResults() | |
MyRayTraceResults.GetTextFile('E:\Text.txt') | |
print(MyRayTraceResults.NumberOfRayData) | |
# Close RayTrace | |
MyRayTrace.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment