Skip to main content
Solved

Can't set reference via API for Geometric Image Analysis

  • September 15, 2024
  • 2 replies
  • 59 views

John.Hygelund
Fully Spectral
Forum|alt.badge.img+1

I’m having trouble setting the reference to Chief Ray via the API for a Geometric Image Analysis

below is what I have in Matlab, everything works but the highlighted line

Any help will be greatly appreciated!

Best answer by David.Nguyen

@John.Hygelund

 

This works for me in Python:

geom = TheSystem.Analyses.New_GeometricImageAnalysis()

settings = geom.GetSettings().__implementation__
settings.Reference = ZOSAPI.Analysis.Settings.ReferenceGia.ChiefRay

geom.ApplyAndWaitForCompletion()

Ignore the __implementation__, this is a peculiarity of Pythonnet I believe. The line:

settings.Reference = ZOSAPI.Analysis.Settings.ReferenceGia.ChiefRay

Should work in MATLAB. Whenever a setting is implemented as a drop-down menu in the user interface, you should expect that an Enumeration is used in the ZOS-API. This means, the corresponding setting is probably not a string such as “Chief Ray”. Instead, it should be coming from a list of predefined values.

Also, in your code you wrote ReferenceGia, this is a type, the property is Reference. I hope this helps.

Take care,

 

David

View original
Did this topic help you find an answer to your question?

2 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1125 replies
  • Answer
  • September 16, 2024

@John.Hygelund

 

This works for me in Python:

geom = TheSystem.Analyses.New_GeometricImageAnalysis()

settings = geom.GetSettings().__implementation__
settings.Reference = ZOSAPI.Analysis.Settings.ReferenceGia.ChiefRay

geom.ApplyAndWaitForCompletion()

Ignore the __implementation__, this is a peculiarity of Pythonnet I believe. The line:

settings.Reference = ZOSAPI.Analysis.Settings.ReferenceGia.ChiefRay

Should work in MATLAB. Whenever a setting is implemented as a drop-down menu in the user interface, you should expect that an Enumeration is used in the ZOS-API. This means, the corresponding setting is probably not a string such as “Chief Ray”. Instead, it should be coming from a list of predefined values.

Also, in your code you wrote ReferenceGia, this is a type, the property is Reference. I hope this helps.

Take care,

 

David


John.Hygelund
Fully Spectral
Forum|alt.badge.img+1
  • Author
  • Fully Spectral
  • 71 replies
  • September 16, 2024

@David.Nguyen ,

Thank you for the support, your example works in Matlab.

I appreciate you explaining the enumeration for the drop downs.

Thanks again!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings