Find out how you can save time and energy using the Zemax Programming Language!
- 165 Topics
- 441 Replies
Hello. I’m interested in running optimization targeting to get a specific beam shape on image. The beam is generated using POP Gaussian angle. The analysis i want to run requires a macro code. For that I’m going to use the ZPLM operand. My question is how do I read POP analysis Text data tab with the ZPL? I want to process the data and to return the macro result to the merit function ThanksRaphael
Dear support team, it seems that a 'Print' statement in ZPL is suppressed during the script is running. Then at the end of the script all print statements are executed at once. I guess, this is a kind of optimisation? However, I am running large scripts and I would like to see the progress in the command window . So I would like the print statement to react directly when it is called. Is this possible? Thank you, Christof.
Hi, I've recently experienced an issue when using ZPL/Zrdplayback command for optimizing a non sequential system. The local optimizer/orthogonal descent, worked fine, but the two global optimizers (Global search & Hammer) stopped at the start of the optimization process with the following error message 'Unable to save file...'. I've found a design file in this forum showing the same behavior (please check the attached file). I suspect that the problem arises when several variations of the initial model are generated and attempt to create and/or read the rayfile from the ZPL macro. Could you please comment and propose a fix that would ideally, preserve the call to zrdplayback? Thank you
Hi Sir/Madam,I am trying to get the peak irrandiance through ZPL language, but seems do not have command fit my purpose.I am thinkging if I could use NSDD to get flux value in position space for each pixel# and compare each value with a command like “maximun” to get the peak one in a array, then I still could reach my purpose. But is there any command for me could do it to get maximun value? and how should I use it? SincerelyDavis
Hello, I created a ZPL (ZPL02.zpl), it seems to work if I run it directly through Programming>Edit/Run, but not inside the merit function.PRINT "worst case : ", worst_colorOPTRETURN 0, worst_colorThose two lines do not give the same value. The first one gives a correct value. In addition, when I call this ZPL through the merit function, it does not update the output value.What should I do?Thanks in advance for your help,
Is there a list of ZPL reserved terms, such as.…$FILENAME()$DATE()I know that these are not high priority terms like the optimization operands, but they are useful when crafting output text. Others might be PATH, and some of the System Parameters. Thanks
Hi! I’m trying to write a little for-loop that loops through various field angles, stop when vignetting occurs on any surface, however, somehow it doesn’t seem to ‘register’ vignetting. I’m confused why this is the case and how I should go about trying to solve it. Would appreciate any comments/suggestions/advice on this. Thank you!My observation: For any max field in the loop > 179.9 deg, FLDY(1) and MAXF() would both give me 179.9 degrees. For any max field <= 179.9 deg, FLDY(1) and MAXF() would give me a value that correspond to the max field. Regardless of the max field in the loop, RAYV() would be printed as 0. I’ve tried it with RAYE() and I would get 0 regardless too. [Mod note: moved to more appropriate forum for ZPL-related discussions.]
I want to get phase and amplitude infromation from huygens psf on some lens. However, in huygens psf, only the information of the last surface=image surface are provided. In that case, if i ignore the last surface in lens data editor, the lens just before the last lens is assigned as an image surface. I want to operate this process in zpl, but i cannot find any command related to ignoring the lens. I'm writing to ask for your help. Thank you all
The NSRA operand is very powerful since you can get almost all ray data about a given segment without saving a ZRD. However, access to which face a segment hit is impossible without saving a ZRD to disk and then parsing the ZRD; the ZOS-API single & batch ray trace for non-sequential mode piggyback on the old DDE structs which are limited to 18 data values, which is why the IRayTraceNSCSourceData is limited to 18 outputs (and Face Data is not one of those outputs).This severely limits ray/object analysis in non-sequential mode. The quickest solution to programmatically access Face Data would be to simply add Data 40 to the NSRA operand so you can test which face a segment hit and then get the needed information by using the other Data values.
Hello ! I am making a comparison of surface overlaps for surfaces that repeat in more than one configuration using a ZPL macro. This task would be much easier if I know a command to specify the active surfaces in every configuration. I searched the Zemax help in zpl macro programming . I could not find a solution. Any suggestion from your end would be valuable. Kind Regards,Santhoshi
Hi all,I want to save data and images of detectors automatically with ZPL. So I made the ZPL code as below. For n = 2, 6, 1 ####### get Detector viewer in img. winnum = n+1 OpenAnalysisWindow "Dvr", cfgpath$ ExportJPG winnum, imgfile$ ####### get Detector viewer in dat. #ModifySettings cfgtxt$, DVW_SHOW, 1 # extraction middle row data from 2d data GetTextFile datfile$, "Dvr", cfgtxt$ , 1 ConvertFileFormat datfile$, 1 #Unicode to ANSINext Once I open all detector viewer windows, I tried to save images and data in detector number order. However, I couldn’t save each detector data/image because it cannot recognize the number of detector in this code. What should I do? Or, are there better method to do it? Please help me. Thanks in advance.
Hello! I am new to ZPL Programming. I currently have the task to extract clear aperture values from Zemax (not according to surface number but the surface names ) using a ZPL macro. I am currently struggling to find the right command. It would be great if someone could help. Kind Regards,Santhoshi
In otpicstudion I am using, there are two way to get edge spread function. One is gemetric ESF, and the other is FFT ESF. I guess that FFT ESF are based on FFT, but don't know how the geometric ESF is calculated. Is it based on raytrace method rather than wave property of light?
Error in converting from CodeV file to Zemax. Maximum length for a string variable is exceeded. Please shorten string and try again SEQ Command: VUX 0.2862643455614489e-9 -0.002507618428442271 -0.01007430775580165 -0.02275146039691922 -0.04038529897597765 -0.06242137400922543 -0.08826487454143517 -0.1181757056085635 -0.1349076575530941 -0.152878222887056 -0.1719304103266932 -0.1914365142446497 -0.2096016968531782 -0.2187861418214183 -0.2257120003786426 How to debug this. Please let me know
Suppose I have a source (surface 1) and a detector (surface 2) in NSC mode. I’m trying to make a macro that shifts the detector along Z-axis using the command SETNSCPOSITION but it doesn't seems to work.The syntax is SETNSCPOSITION surface, object, code, valueCan someone please explains each keyword and how to use it? The surface is the detector surface - 2 ? What is the object? code = 3 for Z Value is the new position?\ THANKS
Hi, I'm quite new to Zemax and was wondering if someone could assist me with processing some volume detector data. I'm currently trying to reconstruct some data from the volume detector and display it in 3D using the Voxel Maker macro. However, the process tends to be quite slow and often crashes with large models. I've written a Matlab script that will pass a binary array and compute the 3D voxelization. However, I need a way of exporting all of the detector cross-sections from Zemax, so that they can be passed by the script. Does anyone know of a way I can do this? I know I can save the individual images seperately within the detector viewer, however, these images will contain the legend and axis titles. It will also be very time-consuming doing this for 100+ cross-sections. Any help would be greatly appreciated! Regards, Callum Here's the link to the macro I was using for reference: How to show Detector Volume data in 3-D · MyZemax
How can only OBJECT's Clear Semi-Diameter be enlarged? I mean, I want to increase the size of the object's Clear Semi-Diameter without changing the size of the remaining Lens Surface. Can I know how with below System Explorer Setting? 1. Aperture Type "Float by Stop Size"2. Ray Aiming is "Paraxial"3. Convert Semi-Diameters to Circular Properties in the Lens Data Editor4. Change the field type to 'Object height'.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.