Compile a User-Defined Surface

  • 26 November 2020
  • 2 replies

Hi everyone,


I'm trying to insert a surface using a DLL file, but it looks like my OpticStudio is not recognize the file.

My actions were putting the file in C:\ProgramData\Zemax\DLL\Surfaces (where all the other user define functions located) and then search for this file in the lens data editor.

(I followed the instruction from Without making any changes)


Looking over the list, I don't see my file.

What could be the reason for that? What is the right way to use user-defined function/ DLL functions?


Thanks a lot!


2 replies

Userlevel 4
Badge +3

Hi Marta,

Try placing your DLL in your user Zemax directory. In my PC, that directory is C:\Users\David\Documents\Zemax\DLL\Surfaces.

I suspect the directory under Program Data is where the install process puts the files before copying them to the user Zemax directory.

Kind regards,


Userlevel 4
Badge +2


Yes, David, you are right, thanks for your answer.

Marta, you will need to place your DLL in the DLL folder that is defined within your Data file path in the Project Preferences / Folders tab:

The 'C:/ProgramData/Zemax' folder is where all the Zemax-provided files are stored before being copied over into the 'C:/Users/.../Documents/Zemax' folder, which is where OpticStudio reads files from by default. 

You may find more information about the functionalities of the different Zemax folders in this forum thread:

What is the ProgramData/Zemax Folder for? · MyZemax