Comments (11)
Is there anybody supporting this library or opening issues is a waste of time?
from pyzdde.
The PyZDDE library was mainly created by @indranilsinharoy.
Maybe you try to contact him? I don't know if he still wants to maintain
this library since Zemax/OpticStudio deprecated DDE and switched to a
COM API.
from pyzdde.
Hi @ulip Thanks for providing the comments. This is not the first time you have done this 👍
Hi @echatziz I would very much love to actively maintain this library. Unfortunately, after leaving school, I do not have access to a Zemax license. Therefore, I really have no way way of fixing bugs and verifying. That's one of the reason, based on @LucVV 's suggestion, I moved PyZDDE into the organization xzos so that other people interested in maintaining this look could do it.
Regarding the above function zSetNSCProperty()
, I don't exactly remember, do you need to be in the NSC mode? Do you have any error messages? What is the return value from the function? If successful, the function is expected to return the same same data as returned by zGetNSCProperty()
. If the command fails, it returns -1
.
Hi @LucVV , if you have some time, can you please take a look at this. Thank you very much.
from pyzdde.
Hi @echatziz, @ulip and @indranilsinharoy, sorry for the late reply. I have little experience with the zSetNSCProperty()
function, but I tried is just now and I got it to work by changing "1,2,1"
to '"1,2,1"'
. It looks as if the command that is parsed needs the brackets within the string.
These are the steps that I used:
- Open a new file in the NSC editor.
- Define the first object as rectangular volume
- Set the volume physics model to angle scattering
- Set the wavelength to preset F,d,C (visible)
- Run the following code from python:
import pyzdde.zdde as pyz
ln = pyz.createLink(True)
ln.zSetNSCProperty(1, 1, 0, 86, '"1,2,1"')
wlshift = ln.zGetNSCProperty(1, 1, 0, 86)
print(wlshift)
Does this work for you?
I will think about a way to circumvent this error. Is it only this functionality that does not work, of do you have other problems as well?
Luc
from pyzdde.
Yes, adding single quotes around double quotes worked.
Thank you. I don't have some other issue for now.
By the way, is there a way to access the "Phosphors and Fluorescence" tab of the newer versions of Zemax, with PyZDDE? Not even Zemax ZPL supports that, the Zemax people told me to use the ZOS-API if I want to access that tab programmatically.
from pyzdde.
Glad to hear that it worked! For your other question, I do not have the premium edition, so I cannot access it at all.. I give you little chance if the ZPL does not support it, but you could check the logical next increment. Else, you could check PyZOS to use the API if you really need it.
from pyzdde.
@LucVV Thanks very much for your help :-)
@echatziz , @LucVV I'm not sure why we need to use the single quotes around the double quotes '"1,2,1"'
. It could be a Zemax thing! Would you input the wavelength shift as "1,2,1"
in Zemax if you used Zemax directly? Something to check!
Regarding the other question. If "Phosphors and Fluorescence" is a recent feature, most likely PyZDDE cannot be used for that since Zemax stopped updating there DDE based interface following the release of ZOS-API.
from pyzdde.
My best guess is that it goes wrong in the interpretation of the string that Zemax recieves. Without the quotation marks, this string is 'SETNSCPROPERTY, 1, 1, 0, 86, 1,2,1'
, in which it might assume that the 1,2,1 are three separate passed arguments.
In the ZPL, you would use SETNSCPROPERTY, 1, 1, 0, 86, "1,2,1"
, so by adding an additional set of quotation marks, we match the ZPL.
As for the recent feature, I estimate (but cannot check) that it is not possible. However, it is an additional option on an already existing feature, which has 3 in stead of 2 options, which is why I gave it a slight chance to actually work. @echatziz could you inform us if it does?
from pyzdde.
@LucVV Thanks for the explanation. It makes sense. Does that mean we need to account for this (i.e., when the data is expected to be string) in the zSetNSCProperty()
function?
from pyzdde.
No, just incrementing the zSetNSCProperty(1, 1, 0, 81, 2) by one didn't work for accessing the Phosphors and Fluorescence tab, but thank you for the suggestion.
The feature by the way is not that new, it's been there for some years
from pyzdde.
@indranilsinharoy I think it is just this specific case, were there is a string with commas in it that might be evaluated as additional arguments. When I was checking this function, I also used it to set the comment on a filed and that worked fine. (In hindsight, it might be good to check what happens if I want a comma within that comment). I will try to check how it works with the comment somewhere this week. If this also gives the error, then I guess we have two options:
- Add information to the docstring on strings with commas
- Make the double quotations the standard behaviour ( not sure if this has an effect on the functionality)
I will try to do the evaluation this week
from pyzdde.
Related Issues (20)
- zGetImageSimulation not working HOT 2
- Problem getting zGetZernike about list indices HOT 12
- ERROR: Unable to establish a conversation with server (err=0x400a). HOT 5
- GetPSF with OpticStudio 20.3.1
- ZBF file created with PyZDDE
- ImportError: bad magic number in 'pyzdde.arraytrace': b'\x03\xf3\r\n' HOT 4
- Assembling zSetField return tuple in Opticstudio 17.5 broken HOT 1
- WindowsError: [Error 126]
- Problem getting RMS Field Map Data out as a Text File HOT 3
- which versions of zemax are compatible
- Error message : UTF-16 stream does not start with BOM HOT 1
- Error of zGetSurfaceData HOT 1
- Which Zemax version is required?
- Closing ZRD file before raising Exception in pyzdde.zfileutils.readZRDFile
- PyZDDE giving different results than Zemax HOT 3
- zSetField not working HOT 3
- Is the NOBJ(surface) command supported? HOT 1
- Is there a set glass data functionality? HOT 5
- Zemax subscription model breaks DDE - fixed promised by Zemax HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyzdde.