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?
답변 (1개)
Indranil Sinharoy
2013년 6월 1일
편집: Indranil Sinharoy
2013년 6월 3일
1 개 추천
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
Lydia
2015년 4월 8일
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!
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!