execute zemax macro with mzdde

I am trying to control Zemax with Matlab's mzdde.
I want to execute a Zemax macro using Matlab but can't figure out how. If the macro window is open and I use zPushLens, it will execute (since all windows are updated) but that isn't a very elegant solution. Someone suggested using the zGetTextFile with "Zpl" as the analysis type, but I don't see how that calls a specific macro.
Does anyone know how to call macros from Matlab?

Antworten (1)

Indranil Sinharoy
Indranil Sinharoy am 1 Jun. 2013
Bearbeitet: Indranil Sinharoy am 3 Jun. 2013

1 Stimme

Try zOpenWindow(ButtonCode). Where the ButtonCode is the first 3 letters of the name of the ZPL macro. Note that the ButtonCode is case sensitive. However, there are certain limitations to this, which are:
1. Currently one can only "execute" a existing ZPL macro without modification.
2. If it is required to redirect the result of executing the ZPL to a text file, modify the ZPL macro in the following way:
(a) Add the following two lines at the beginning of the file:
  • CLOSEWINDOW # to suppress the display of default text window
  • OUTPUT "full_path_with_extension_of_result_fileName"
(b) Add the following line at the end of the file:
  • OUTPUT SCREEN # close the file and re-enable screen printing
3. If there are more than two macros which have the same first 3 letters then all of them will be executed by Zemax.
Hope that helps.

1 Kommentar

Lydia
Lydia am 8 Apr. 2015
Hi,I found this thread very helpful, however I have a related question: is there a way to interact with the macro while executing it? I am using a macro that requires user input before it executes further. Thanks!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 16 Mai 2013

Kommentiert:

am 8 Apr. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by