Skip to main content
Solved

ZOS-API: How to save/load a .FLD file into a system

  • September 5, 2023
  • 1 reply
  • 117 views

Julia
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 53 replies

Is it possible to save and load .fld files in the Field Data Editor using the ZOS-API method?

Best answer by Julia

Unfortunately, the function is not included in the ZOSAPI methods list. Therefore, it is not possible to use it directly to save and load fields, as in the UI. However, the .fld file saves the field type and each field's values in the field data editor with the following format(utf-16).

 

To apply these values to your system's field data editor table as the "fld" way, save this data as a text file. Please refer to the provided Python code.

Save and load field data in Python, use the following functions that are defined in the attached file:

  • To save field data, use the SaveFields(TheSystem,filepath)function.
  • To load field data, use the LoadFields(TheSystem,filepath) function.
View original
Did this topic help you find an answer to your question?

1 reply

Julia
Zemax Staff
Forum|alt.badge.img+2
  • Author
  • Zemax Staff
  • 53 replies
  • Answer
  • September 5, 2023

Unfortunately, the function is not included in the ZOSAPI methods list. Therefore, it is not possible to use it directly to save and load fields, as in the UI. However, the .fld file saves the field type and each field's values in the field data editor with the following format(utf-16).

 

To apply these values to your system's field data editor table as the "fld" way, save this data as a text file. Please refer to the provided Python code.

Save and load field data in Python, use the following functions that are defined in the attached file:

  • To save field data, use the SaveFields(TheSystem,filepath)function.
  • To load field data, use the LoadFields(TheSystem,filepath) function.

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