Coder Social home page Coder Social logo

Comments (6)

je-ro-me avatar je-ro-me commented on September 15, 2024

Some more information :
with the above code, the semi-diameter of surf 3 is set to 20 in Zemax when calling link.zPushLens(). The same function link.zPushLens() sets the system STOP back to surface 1.

from pyzdde.

indranilsinharoy avatar indranilsinharoy commented on September 15, 2024

Hi @je-ro-me,

Honestly I don't know what's going on. It seems very strange because there is NO reason AFAIK why the system aperture would change automatically by calling zPushLens(). This function just "moves" the current lens in the DDE server to running Zemax application's LDE. Also, as you have experimented yourself with two other files, the behavior seems consistent with our expectation. Can also print the system data (zGetSystem() before calling zPushLens() to see if the stop surface is 3? Also, are you absolutely sure that there are no other calls such as zGetRefresh() or zGetUpdate(), in between? I don't have a zemax usb key with me right now (I will probably have one tomorrow). If you have not resolved the issue by then, I will test out some scenarios tomorrow. Keep me posted.

from pyzdde.

je-ro-me avatar je-ro-me commented on September 15, 2024

Hi @indranilsinharoy
Thanks very much for your reply!
I could resolve the problem partly as follows: I re-create the same optical file from scratch and got a second Zemax file that looks identical (could not see a difference in the lens specifications, achieved performances, system parameters, etc..). And with this file the call of link.zSetSystemAper() works well.
So I solve the problem for my needs, but could not understand the issue which I don't really like.
I wonder if I missed some parameter when making this second file, or if there may be something with the file I was using (e.g. I think it was created with an older Zemax version) ?

In any case, using the old (problematic) file:

  • I confirm I don't make any call to zGetRefresh() or zGetUpdate()
  • if I use zGetSystem() before trying to set the aperture, after trying to set the aperture=before calling zPushLens(), and after calling zPushLens() I get the following in the Console window:

systemAper(apertureType=3, stopSurf=1, value=39.8)
systemData(numSurf=20, unitCode=0, stopSurf=1, nonAxialFlag=1, rayAimingType=2,
adjustIndex=1, temp=20.0, pressure=1, globalRefSurf=2)

systemAper(apertureType=3, stopSurf=3, value=20.0)
systemData(numSurf=20, unitCode=0, stopSurf=3, nonAxialFlag=1, rayAimingType=2,
adjustIndex=1, temp=20.0, pressure=1, globalRefSurf=2)

systemAper(apertureType=3, stopSurf=1, value=39.8)
systemData(numSurf=20, unitCode=0, stopSurf=1, nonAxialFlag=1, rayAimingType=2,
adjustIndex=1, temp=20.0, pressure=1, globalRefSurf=2)
Press any key to continue . . .

from pyzdde.

indranilsinharoy avatar indranilsinharoy commented on September 15, 2024

Hi @je-ro-me,

I really don't have any idea why this is happening. This is not an expected behavior, and in my few years of using PyZDDE, I have never faced such an issue. Also, this type of cases are hard to debug without the lens file. However, I am almost certain that the problem is not due to PyZDDE.

As far as ensuring that you have created the new design without missing any parameters, I would start with the following:

  1. Most of the zmx files are basically text files (unless they are encrypted I guess) so I would first try to use any file compare tool to find the differences in the .zmx file
  2. I would suggest that you ask in the Zemax forums if there are any formal method for comparing two zemax files.

from pyzdde.

je-ro-me avatar je-ro-me commented on September 15, 2024

Hi @indranilsinharoy
I think I found where the problem comes from!
As you suggested, I tried to track all differences between the two files.

  • first, I used the file comparator from Zemax, but it doesn't show any difference
  • when opening the .zmx files with a text editor I noticed few small differences.
    In particular I spotted some lines at the end of the old file (the one that creates the problem) that are not in the new file.

The end of the new Zemax file:

BLNK
TOL TOFF 0 0 0 0 0 0 0 0
MNUM 1 1
MOFF 0 1 "" 0 0 0 1 1 0 0.0 "" 0

The end of the old Zemax file (for which link.zSetSystemAper() doesn't work):

CONF 1 0 0 0 0 0 0 0 0 0
BLNK
TOL TOFF 0 0 0 0 0 0 0 0
MNUM 1 1
WAVE 1 1 6.770000000000E-001 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
MOFF 0 1 "" 0 0 0 1 1 0 0.0 "" 0
YFIE 1 1 0.000000000000E+000 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
YFIE 2 1 0.000000000000E+000 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
MOFF 0 1 "" 0 0 0 1 1 0 0.0 "" 0
XFIE 1 1 0.000000000000E+000 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
XFIE 2 1 1.000000000000E-001 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
STPS 0 1 1.000000000000E+000 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
APER 0 1 3.980000000000E+001 0 0 0 1 1 1.000000000000E+000 0.000000000000E+000 0 "" 0
MOFF 0 1 "" 0 0 0 1 1 0 0.0 "" 0
MOFF 0 1 "" 0 0 0 1 1 0 0.0 "" 0
MOFF 0 1 "" 0 0 0 1 1 0 0.0 "" 0

If I delete the two lines that start with "STPS" (for stop system? seems to indicate that the system stop is at surface 1) and "APER" (seems to set the system aperture size), then the call to link.zSetSystemAper() works well!
Interestingly, if I delete only the line with "STPS" then the call to link.zSetSystemAper() can change the stop position to surface 3, but not its size.
So it seems that PyZDDE cannot modify the system stop position and size if they are indicated by extra lines at the end of the .zmx file.

from pyzdde.

indranilsinharoy avatar indranilsinharoy commented on September 15, 2024

@je-ro-me

That's interesting. However, I don't know exactly what settings in lens design (adds the two lines in the end) and prevents modification of the aperture settings via an external interface. I will keep your findings in mind in future. Thanks. I'm glad that you were able to resolve the problem.

Also, since it is not really a PyZDDE issue, I am going to close it.

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.