Coder Social home page Coder Social logo

Comments (11)

echatziz avatar echatziz commented on September 15, 2024

Is there anybody supporting this library or opening issues is a waste of time?

from pyzdde.

ulip avatar ulip commented on September 15, 2024

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.

indranilsinharoy avatar indranilsinharoy commented on September 15, 2024

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.

LucVV avatar LucVV commented on September 15, 2024

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:

  1. Open a new file in the NSC editor.
  2. Define the first object as rectangular volume
  3. Set the volume physics model to angle scattering
  4. Set the wavelength to preset F,d,C (visible)
  5. 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.

echatziz avatar echatziz commented on September 15, 2024

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.

LucVV avatar LucVV commented on September 15, 2024

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.

indranilsinharoy avatar indranilsinharoy commented on September 15, 2024

@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.

LucVV avatar LucVV commented on September 15, 2024

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.

indranilsinharoy avatar indranilsinharoy commented on September 15, 2024

@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.

echatziz avatar echatziz commented on September 15, 2024

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.

LucVV avatar LucVV commented on September 15, 2024

@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:

  1. Add information to the docstring on strings with commas
  2. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.