I am trying to write an interactive extension using the COM (not .NET) framework, and need to change some settings. I have read through (and watched the videos) regarding navigating the API Syntax Help tool, and have spent considerable time scanning the forum and the sample code for guidance.
Specifically, I am using the FFT PSF Cross Section analysis, and want to change the Type: to X-Linear or Y-Linear, like this:
To try and sort this out, I tried to do the exact same thing as one does in setting the 'Refer To' field in the Standard Spot diagram (it is also an Analysis window with a drop-down menu of fixed selections) I found the following code snippet in example 22:
spot = TheSystem.Analyses.New_Analysis(constants.AnalysisIDM_StandardSpot)
spot_setting = spot.GetSettings()
baseSetting = CastTo(spot_setting, 'IAS_Spot')
baseSetting.Field.SetFieldNumber(0)
baseSetting.Wavelength.SetWavelengthNumber(0)
baseSetting.ReferTo = constants.ReferTo_Centroid
Here is the relevant part of the API help tool and the associated code:
Here is the same thing for setting the FFT PSF Cross Section type to Y_Linear:
By exact analogy to the Standard Spot settings, I tried the following code (and at least a half-dozen variants), without success:
fftc = TheAnalyses.New_Analysis(constants.AnalysisIDM_FftPsfCrossSection)
fftc_setting = fftc.GetSettings()
baseFftcSet = CastTo(fftc_setting, 'IAS_FftPsfCrossSection')
baseFftcSet.Field.SetFieldNumber(2)
baseFftcSet.Wavelength.SetWavelengthNumber(1)
baseFftcSet.Type = constants.Type_Y_Linear
The SetFieldNumber and SetWavelengthNumber commands work, but the last line throws a 'AttributeError: Type_Y_Linear' error. By the way, I did spot that the Zemax GUI uses dashes: 'X-Linear', whereas the API reference is an underscore: 'X_Linear'. This is among the many variants I attempted.
Any ideas?
Thanks,
Tom Herbst