    

 ## On this page

  

 

 # Example 03: Open File and Optimize

 Last update: 09.03.2026 

Ex 3: An API file (…\\Samples\\API\\\[language\]\\e01\_new\_file\_and\_quickfocus.zos) is opened, and some surfaces and radii are made variable. A merit function which constrains air and material thicknesses, and targets astigmatism and coma, is generated manually by inserting operands and adjusting parameter values. The local optimizer is run to completion, and then the hammer optimizer is run for 10 seconds.

```
Input:		API\[language]\e01_new_file_and_quickfocus.zos

Output:		API\[language]\e03_open_file_and_optimise.zos

```

[C#](example_03_cs.md)

[C++](example_03_cpp.md)

[Mathematica](example_03_nb.md)

[Matlab](example_03_m.md)

[Python](example_03_py.md)