zos api: change surface for geometric image analysis
Hello! Can somebody please help me figure out how to change the surface for geometric image analysis? I’d like it to default to the image surface.
gia_run = TheSystem.Analyses.New_Analysis_SettingsFirst( ZOSAPI.Analysis.AnalysisIDM.GeometricImageAnalysis ) # make new analysis, but don't run it gia_settings = gia_run.GetSettings()
# I was hoping for something like the following (this doesn't work though) gia_settings.Surface = ZOSAPI.Analysis.Settings.Surface.IAS_Surface.UseImageSurface
Thanks!
Liz
Page 1 / 1
You’re almost there, but you have to use something like so:
The Surface property returns an interface that has several methods:
GetSurfaceNumber ()
SetSurfaceNumber (int N)
UseImageSurface ()
UseObjectiveSurface ()
You can find those if you click on IAS_Surface on the left of the Surface property in the Syntax Help.
I hope this helps. Take care,
David
got it, thanks for your help. for anybody interested in how I ultimately did this, I’m making zemax analyze the last surface with
last_surface_number = TheLDE.NumberOfSurfaces - 1 gia_settings = gia_run.GetSettings() gia_settings.Surface.SetSurfaceNumber(last_surface_number) #analyze GIA on the last surface
best,
Liz
That’s an excellent solution.
Sorry if I wasn’t clear when I listed the methods of IAS_Surface, but you could also try:
gia_settings.Surface.UseImageSurface()
Take care,
David
GeometricBitmapImageAnalysis have same settings or different than GeometricImageAnalysis ?
with code below have error
AttributeError: 'AS_Default' object has no attribute 'Surface'
what is AS_Default? how find which code words should I use?
@Aleksandr.Makarov
Every analysis has a boolean property HasAnalysisSpecificSettings. If this property is True, it means its settings are available from the ZOS-API directly. Otherwise, it means you’ll need to use a settings file or you might not even be able to access those settings. Geometric Bitamp Image Analysis returns False.
The latter approach is similar to what you’d do in ZPL and I wrote a topic about how to modify those settings that are not otherwise accessible some time ago here. In the settings of each analysis you have the following methods to perform the same operations as in ZPL more or less:
Hopefully this is clear, let me know if you need a more detailed example.
It seems I wasn’t clear with my previous answer. The settings of Geometric Bitmap Analysis are not implemented in the ZOS-API yet. Therefore, I can understand that your code above doesn’t work. Instead, this is what you need to do:
The ModifySettings method in the ZOS-API is similar to its ZPL counterpart MODIFYSETTINGS. It takes a string code (in this case GBM_OUTPUT) to modify a particular setting of an analysis inside the *.CFG file associated to it. The list of string codes can be found in the ZPL Help section of MODIFYSETTINGS.
Note that with this way of modifying the settings, you need to create the *.CFG file with SaveTo. This is similar to pressing the Save button at the bottom-right of your analysis settings.
I hope this is clearer. In the future, I believe ANSYS wants to have all the settings implemented in the ZOS-API but in the meantime we have to use this method.
Take care,
David
@David.Nguyen how I can customize folder where will be saved image? I finded changing folder option(which for some reason not work for me), but not sure if zemax can understand where find “input image” for this analysis, if I change default folder to different in cycle
I understand it would be nice if the data was saved at the right location from the git-go but on the flip side, the method you are referring to might add some overhead in a loop (but I haven’t tested it).
Take care,
David
@David.Nguyen why with this code, zemax make 2 calculations of same analysis? I have presaved .CFG file.
Could you please create a new topic for this question? I feel it departs from the original topic here. Also, could you clarify in comparison to what you notice the 2x increase in time?