execute zemax macro with mzdde
Mostrar comentarios más antiguos
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?
Respuestas (1)
Indranil Sinharoy
el 1 de Jun. de 2013
Editada: Indranil Sinharoy
el 3 de Jun. de 2013
1 voto
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 comentario
Lydia
el 8 de Abr. de 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!
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!