Skip to main content
Question

FindMaterialCatalog returns first catalog for material ABSORB

  • July 2, 2025
  • 1 reply
  • 18 views

mocquin
Ultraviolet

This looks like a bug in ZOS API : when calling FindMaterialCatalog on a row of a non-sequential model with ABSORB as mateial, it returns the first catalog in the available catalog list
I would except this call to return None or “”

1 reply

David.Nguyen
Luminary
Forum|alt.badge.img+2

@mocquin 

 

I don’t think it is a bug per se.

It is my understanding that the ZOSAPI is heavily based on the code base of OpticStudio. It would make sense, why would you reprogram functions that already exists.

To understand the behavior of FindMaterialCatalog, one has to figure out where it is used in OpticStudio.

Whenever you click on a Material cell (sequential or non-sequential) and then run Libraries..Materials Catalog. The Materials Catalog opens exactly on that material’s entry, including the corresponding Catalog.

So what happens if you click on a cell that has ABSORB as a Material?

It opens the upmost Catalog in the list, and the upmost Glass of the catalog list. In that sense, FindMaterialCatalog from the ZOSAPI does what its supposed to do.

There’s another detail to consider, there are not many materials that don’t have a Catalog associated to them. I can think of ABSORB and MIRROR, and based on what happens in the user interface I’m assuming an empty Material cell will also open the upmost Catalog (I haven’t checked). It might make more sense to check if the material is one of those before looping through the catalogs with FindMaterialCatalog in terms of computational complexity.

I also thought of creating an empty catalog “_EMPTY.AGF” so that it would be at the top of the list, but it doesn’t seem to behave as expected in the user interface (I didn’t check in ZOSAPI). Instead the Materials Catalog is empty if the Material cell is empty, or it is the last Materials Catalog in the System Explorer for ABSORB.

Take care,

 

David

 


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