Skip to main content

Hi.


I am looking for an efficient way to manage large collections of user-defined apertures from the ZOS-API. As a compatible use-case, think e.g. of a database of eyewear lens shapes. The lens shapes (defined as UDAs) would ideally live in a case folder together with other information about the eyewear (think: prescription, etc.), and not in the standard folder used by Zemax. 

It seems like the only file location that UDA files can be loaded from to configure a ZOSAPI.Editors.LDE.ISurfaceApertureUser. is <Zemax>\Objects\Apertures. Passing a full path -- I am using python’s os.path.abspath() and have also tried just the verbatim path as raw string -- to the user aperture interface’s ApertureFile property does neither cause an error, nor result in the aperture file being used. Passing simply the name of a UDA file that is located in <Zemax>\Objects\Apertures works as it should.

The location of the “Apertures” folder can only be changed by changing the location of the “Objects” folder in the preferences, which is undesirable in my case, since other objects are commonly needed in my files at the same time and I would need to make copies of those for each case.

Is there a way to resolve this? I am using e.g. GridSag surfaces with datafiles from arbitrary locations (passed to ZOSAPI.Editors.LDE.ILDEImportData.ImportDataFile for the GridSag surface row) and would love the same conceptual simplicity for UDAs (and potentially other object files). 

Hi @Stefan.Trotzky,

Apologies on the delayed response to your question. In case it is still relevant or for the benefit of others:

It doesn’t look like there is a simple way to pass a file to ZOSAPI.Editors.LDE.ISurfaceApertureUser without using the specified Objects directory. One possible option: using the code that calls the ZOS-API to manage the files for you. Before setting the ApertureFile property, you could copy the target file into the Apertures directory. Then after you finish the analysis and data retrieval, you can programmatically delete the file and get ready to copy in the next UDA file. In this way, you are retrieving the files from your customized folder structure, while also satisfying OpticStudio’s need to look in the Objects folder. I realize this is just a workaround, but it should achieve the functionality you describe.

Best,
Ethan


Reply