Find out how you can save time and energy using the Zemax Programming Language!
- 130 Topics
- 348 Replies
Hello,I have a system with a non-circular aperture and therefore try to calculate its effective f number using the operand EFNO(effective f number). However, I get different results when using the operand EFNO, in comparison to the result given in the relative illumination analysis, despite the same setting is applied on both calculation. (wavelength 3 is 0.555µm, and field 1 corresponds to 0 y field) As can be seen above, one gives a value of 4.13(EFNO), while the other gives a value of 3.85. I think the latter one should be correct, but the question is why does one get different results here, do these two use different algorithms for calculation? How can I calculate this value in a Zemax macro conveniently if the result provided by EFNO is not trustworthy…. Thanks a lot in advance!
Hi all,I’m trying to use ssag operand to obtain the surface sag in sequential mode. I’m ok with using it in the merit function editor, however, as I have a lot of sampling points, manually inserting ssag function is a real pain. Is there any method to use SSAG in the ZPL Marco where I can write my own loop? Best wishesDaoming
HiI am trying to calculate the RMS slope of a surface with the DSLP operand in a macro.The surface is Zernike Standard Sag (generated from tolerance analysis) and the rms slope of this surface computed in the MF editor is like below I wrote the following to calculate the same value in a macro:> print OPEV(OCOD("DSLP"),1,1,2,0,0,1)but this is obviously not correct as the output is 3.4456 (I was excpecting 4.913e-5).I can’t find the error, can you? :-)Thank you
Hello Community, I am working on making a macro and would like to know how I can set the object type, for example, Source Two Angle.There is only one example that Standard Lens to be described as “NSC_SLEN” in the ZEMAX Manual and I cannot find the information for other objects.Your support would be greatly appreciated.Thank you. Kind regards,Ryo
How does one do a bulk raytrace in ZPL, similar to pressing the “Ray Trace” button in regular, non-sequential mode. From the help files, it looks like RAYTRACE and RAYTRACEX only traces one particular ray, which is not useful for determining the total illumination on a detector. Thanks!
Sometimes, we may design the system starting from the 'image' back to the 'object'. For example, this is often the case for those systems that are designed to be viewed by eye, like AR/VR, HUD. In this case, normally, if we want to check the relative illumination, we need to reverse the system to check because the tool 'Relative Illumination' only calculates that on last surface in the system.Here we will provide another way to calculate it using a macro so that you don't need to reverse the system.Note here we at the same time is also demoing how you can verify the calculation theory of the RI. RI is actually much easier to calculate if the system is reversely designed! First, by reading the following forum post, we know that relative illumination at each field is exactly linearly dependent to the area of the beam in cosine space in image space.So, here is the plan. We want to write a macro to calculate the beam area in cosine space for each field, normalize it, and then get the the R
Hi,I am unable to find DOESAG.zpl macro for getting the sag values for the diffractive aspheric surface. Earlier it was available in the knowledge base but now that is also not there. Can I get this macro as it is very useful to view the steps of diffractive surface and surface sag dataRegardsJ Himavanth kumar
We can use the below code to close the current analysis result and analyze the new filed. The setting file must be created by clicking the Save button.Stngs$="C:\Users\yuan.chen\Documents\Zemax\Configs\TFM.CFG"CLOSEWINDOW WINL()MODIFYSETTINGS Stngs$,TFM_FIELD,3,"TFM"Openanalysiswindow "tfm",Stngs$
For data that require only one parameter, we can use SYPR(). To extract field data, the solution is to use the numeric functions and a loop to extract data. Here are related numeric functions.To read the number of fields or the maximum value, you can use the below funcions to read them:
Hi, I am trying to calculate peak to valley value showing on 'analysis-interferogram' window by ZPL, and use it in the merit function editor with ZPLM operand. But I have no idea how to directly get the peak to valley value using any kinds of pre-defind functions or else, so currently what I am doing is to save the text file of interferogram analysis result, then read back in, and extract the peak to valley value, then pass it using OPTRETURN. This process seems require a lot of time to calculate system by system during the optimization, so I want to find a quick method to obtain the peak to valley value, instead of what I am doing now. Thank you in advance. And I hope there is a clever way to do this.
I'm having trouble to read detector pixels using a ZPL. The syntax should be NSCDetectorData,surface,object,pixel,data However, I get error message and do not know how to solve. Can somebody provide me with a example of a piece of ZPL code to get the job done. Ideally reading the detector into a 2D array But I'm already happy with a single statement reading out say the 6th pixel iof the 5th row Hope somebody can help me Pascal
Hi, I made a ZPL macro that uses GETPSF to retrieve a PSF to a vector and then saves the vector to a file with a FOR loop on the vector elements. The saving part is extremely low! Is there a better way to save the results? I tried doing the same thing with GETTEXTFILE but the speed is similar, and I lose control on file format and can't seem to find a file to set the parameters such as sampling size. Any help really appreciated! Thanks, Paolo
Hi, I am writing a macro to modify some surface properties and I can't figure out how to define a pickup... Here is what I am trying to do: SRFn (actually a coordinate break) : I use SETVAR to set the parameter #1 to variable SRFn+3 (I want to make it a coordinate break return): I would like to set parameter #1 of this srf by pickup the one of SRFn but I can't find the right ZPL keyword to do that. Any help is welcome.
Need to convert from codeV to Zemax. Can you please provide the latest CodeV to opticsStudioConverter.ZPL macro. The current file is working properly. Following error 0098 SCC C6 0 No mapping for command SCC 0098 Nothing to convert ! Version: 2.06.4 ! August 28, 2019 ! NOTE: This Macro constructs Zemax OS Optical system using Code V seq file 1333 PIK SCO S14 Z2 C8 SCO S14 Z1 C8 1.00162632102796 No mapping for command PIK 1333 Nothing to convert 1334 PIK SCO S14 Z2 C9 SCO S14 Z1 C9 1.00162632102796 No mapping for command PIK 1334 Nothing to convert 1335 PIK SCO S14 Z2 C10 SCO S14 Z1 C10 1.00162632102796 No mapping for command PIK 1335 Nothing to convert 1336 PIK SCO S14 Z2 C11 SCO S14 Z1 C11 1.00162632102796 No mapping for command PIK 1336 Nothing to convert 1337 PIK SCO S14 Z2 C12 SCO S14 Z1
I need to be able to scale a section of a lens system from surface Sj to Sn from within a ZPL macro during optimization. Surface 3 in this system is in collimated light and initially set to 1.0, and can be changed in optimization to scale S7-S9 without affecting the system. The thing being optimized is the S7-S9 EFL. I tried using this macro with no luck. I found no SETSCALE or similar ZPL keyword. How to do this? Thanks, Mike # ZPL20.ZPL # USE T3 IN LENS FILE AS SCALING FACTOR FOR L1/L2 DOUBLET T3 = THIC(3) # Varies from unity during op R7 = RADI(7) * T3 R8 = RADI(8) * T3 R9 = RADI(9) * T3 T7 = THIC(7) * T3 T8 = THIC(8) * T3 OPTRETURN 0, T3 OPTRETURN 1, R7 OPTRETURN 2, R8 OPTRETURN 3, R9 OPTRETURN 4, T7 OPTRETURN 5, T8
Good morning, I am designing a broadband spectrometer (currently in sequential mode). I think someone may answer the following questions way faster than I can. I am interested in measuring the spot size in the dispersion direction (therefore not as a general RMS parameter, as it is usually given). Is there a way in Zemax to automatically measure it through the merit function? I know that the optimization wizard allows to choose a X Weight and an Y Weight. Is there any reference I can read of the topic? Can you advice any specific reference on how to relate the calculated RMS spot size in Zemax to the spectrometer resolution? Thank you very much, Cinzia
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.