Solutions to hide details of a ZPL macro

  • 23 November 2023
  • 3 replies

Dear Zemax community,

I currently have a ZPL macro that has two inputs taken from the MCE and computes the radius of curvature of a surface, based on these two values. What is useful is that I can set my two inputs as variables and run some optimization so i’m quiet happy about it.

Now I would like to hide the equation so that my zemax file performs the same but no one can access the details of the computation within my ZPL macro. I understand there is no way to encapsulate a ZPL macro or create a black box around it. What other options do I have that would work in the same fashion as this ZPL macro?



Best answer by Andrey.Pravdivtsev 21 December 2023, 10:23

View original

3 replies

Userlevel 7
Badge +3

Is your macro implemented as a macro solve? In that case, I don’t think you have any options for obfuscating the file.

If its something you only run once (or some small number of times) you could use ZOS-API to produce a .exe that does the same thing. That would be a binary file so unreadable, and could be further obfuscated if you really need it. 

Dear Mark,

My issue is that it is indeed a macro solve. My output is the radius of a surface which changes based on the two input parameters in my MCE. I am often using either one of these two parameters to run optimizations in Zemax as well.

Do ZOS-API need to be manually executed or can you call them from a ZPL macro?

Userlevel 3

I suppose you couldn’t run ZOS-API from ZPL.

You can try to create a DLL surface based on the standard surface and put the equation there.