when i use ZPL output to a text file , The output always stops halfway, and Zemax prompts "cannot open text file". Does anyone know why? For example, I plan to output 40,000 lines of data, but it stops at 10,000.
ZPL output err
Best answer by MichaelH
Hi Yonghong,
There is nothing inherent about the file size a ZPL macro can output. I was able to write out 1,000,000 lines to a 25Mb file with the following sample code:
OUTPUT "D:\temp.txt"
FOR i = 1, 1000000, 1
PRINT i
NEXT
OUTPUT SCREEN
Make sure to address the issues that David mentioned. Also, as you see above, I use the OUTPUT SCREEN
command to close the file buffer. If you use OUTPUT file$ and OUTPUT SCREEN a lot inside a FOR loop, you could run into system level file lock errors. If you are opening and closing a file a lot, it’s a good idea to use $TEMPFILENAME()
for each new file (OpticStudio will create a new file in the %TEMP% folder, which is always writeable by the logged in user) and then to join all the individual files after you close them all.
If you can post your ZPL code (along with any needed ZMX files), the community can help more.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.