-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No function to export jpg to file PyZDDE #62
Comments
I've solved the issue by continuously renaming the saved .jpg file via python itself, it's not pretty but it works. Maybe there's a better way to do this, but I'm happy for now:) |
Hi @Toniostado, I am sorry that I couldn't respond to you earlier. The |
I am trying to do the same thing, however when I try to ExecuteZPLMacro('xyz') I get either -999 or -1 return code. I am able to use the 'CALL MACRO' operand in Zemax and run the secondary macro, but unable to do so in PyZDDE |
@shbhuk The errors you are seeing could be due to a couple of reasons. Where does the zpl macro file which you are trying to execute reside? Is it in the default location (i.e. in
See the example below (I just executed in Jupyter Console and OpticStudio 16.5): |
The .zpl file is in the default Macro location. |
Hello,
I've come across the ipzCaptureWindow function, but this only seems to work inside the IPython environment. Since I'm working on a bigger project I cannot use IPython. I'd like to export a screenshot of a window to a designated .jpg (or .png or .bmp) file.
I've seen the W01_PyZDDE_ExportJPEGWIN01.ZPL macro, but I cannot dynamically specify the filename, causing it to write it to the same file when I execute the macro multiple times.
I've edited the macro to tell the filename to use the date:
I use the following to execute the macro within python
ln.zExecuteZPLMacro('SAVEIM.ZPL')
This would be a good solution if $DATE() were to return both date ánd time, however, it only returns the date time format from windows, which outputs only Month-Day-Year (and no time) and I need a smaller timescale.
Preferably, I'd like to be able to assign my own filename. Is this possible within PyZDDE?
PS. I need to save a large number of these windows while changing parameters of the design using PyZDDE. So using macro's as a solution is not an option.
Kind regards
The text was updated successfully, but these errors were encountered: