-
Notifications
You must be signed in to change notification settings - Fork 68
zSetField not working #95
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
Comments
Hi @Allvvaro, First of all, sorry for the delayed reply. There was a probleem with the zSetField function for newer Zemax versions, as the return was corrupted. I made a fix, but this is not yet in the package that you install through pip. To use this fix, you could either clone the code from GitHub, or adjust your local package using this fix. Using this fix, the return is as expected again. Does this help you? Kind regards, Luc |
The Zemax version I used is 181119, and I have the same problems. |
Sorry to hear that the fix is not working properly for you. I made that fix because I had a bug on my version, but it seems as if the bug changed for you. I do not have your version, so I cannot really reproduce your issue. However, in the fix linked above, the code that should be executed in your case (as if len(rs) == 2: # The behaviour with the Zemax bug
fieldData = self.zGetField(n) Can you debug to see why this is not the case? If you are not using the return obtained with zSetField(), and just want to make a field adjustment, you could try to define a function that does not handle the reply, such as: def zSetFieldNoReply(self, n, arg1, arg2, arg3=None, vdx=0.0, vdy=0.0,
fd = _co.namedtuple('fieldData', ['xf', 'yf', 'wgt',
'vdx', 'vdy',
'vcx', 'vcy', 'van'])
arg3 = 1.0 if arg3 is None else arg3 # default weight
cmd = ("SetField,{:d},{:1.20g},{:1.20g},{:1.20g},{:1.20g},{:1.20g}"
",{:1.20g},{:1.20g},{:1.20g}"
.format(n, arg1, arg2, arg3, vdx, vdy, vcx, vcy, van))
reply = self._sendDDEcommand(cmd) However, please check carefully if this works, it could be that the bug is located in the send side of the DDE. In that case, I'm afraid you will have to switch to the API. |
Hi there!. I am having problems with zSetField function. Either when using n=0 or n!=0, it returns that number of arguments are not what were expected. I am not sure what I am doing wrong.
For example, using "zSetField(0, 0, 9, 1)" I get TypeError: Expected 5 arguments, got 2.
Similar, if I try "zSetField(3, 0.001, 0.003, 1, 0, 0, 0, 0, 0)" I get "TypeError: Expected 8 arguments, got 2"
What am I missing? Thank you!
The text was updated successfully, but these errors were encountered: