Find out how you can save time and energy using the Zemax Programming Language!
- 109 Topics
- 289 Replies
Hi, I am trying to calculate multimode fiber coupling efficiency by using Geometric Image Analysis through GETTEXTFILE, and I want to do this for different fields and wavelengths. I am trying to change field# and wavelength# by MODIFYSETTINGS, but looks like these two parameters are not allowed to be changed. Following is the list of parameters that MODIFYSETTINGS provides: I wonder if anyone knows how to make the changes so I can do this calculation using ZPL. Thanks!Jizuo
Hello all,I am a student in internship and I need to use ZPL to automate my system. I have a system with LED, which I am optimizing. After this optimization I have to measure the power received on the detector for different Z positions (34 positions).I do not know how to make a list of my different Z positions, how to change the value of the Z position for my detector and how to retrieve the value of the power received on my detector.Thank you in advance,Léo
How to iteratively change the clear semi-diameter of a component and save the resulting wavefront map to a file?
Hi everyone, I’ve recently started using OpticStudio. Currently, I’m trying to incrementally change the clear semi-diameter of a surface within my system. I know this can easily be achieved with a FOR loop.However, for each iteration, I hope to save the resulting wavefront map. Unfortunately, using GETTEXTFILE within a loop does not appear to work as intended, as the FOR loop seems to run as normal, but does not create the required files. I’ve attached my code. If there’s any mistakes or changes that need to be made so that the solver iterates over the semi-diameter values and saves the wavefront map at each step, just let me know. ! Setting the desired format.FORMAT 1 INTFOR i, 0, 6, 1 ! Reducing the clear semi-diameter by 5 lens units per iteration. CLR_SEMI_DIAM = 52 - i*5 ! Returning the new clear semi-diameter to the editor. SOLVERETURN CLR_SEMI_DIAM ! Setting the output filename. FLNM$ = "F:\LGS_104_Wavefront_Map_" + $STR(i) + ".txt" ! Writing the wavefront m
Hi, I'm running Zemax Optic Studio Professional, version 20.2.2. Whenever I'm working with large pixel arrays, or high (> 1024 x 1024) sampling in physical optics propagation, and my detector viewer/beam file viewer is set to text view, I get a message box saying 'Text is too long to display. Use Copy All or Save As' to retrieve the entire file'. This message box doesn't cause a problem as I'm exporting the data in a macro anyway, but it means that during a long macro where I'm running POP multiple times, I have to constantly watch OpticStudio as it pauses the macro until I dismiss the message box, which is obviously impractical. Is there a way to either a) Increase the maximum allowed text file to be displayed within OpticStudio, or b) Suppress the message box, as the data export is absolutely fine Thank you!
Hello,How can I obtain the intensity of single rays (either using ZPL or API) when the apodization is part of a user-defined surface?I used the “us_filt1.dll” example provided with the Zemax distribution and set G>0. The APOI(x,0) operand returns 1.0 for all positions of the pupil (0<x<1), despite the apodization applied in the dll. Thanks!
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'.
such as fist type i used the filed tpye is real image heightbut i want to convert the type to angle through the macro commandSYSP 100,0however it convert result is the field type is angle but the field datas is not changelike the filed data in No. 12 is 3.4mm in real image heightbut after convert the filed data in No. 12 is 3.4° in anglei want to get the results are similar ,the field datas follws the field type
Good afternoon.I have a question about working with numeric variables when writing an ZPL macro. Is it possible to round the values assigned to variables with the required accuracy? I'm looking for functions similar to (FLOOR.MATH) and (CEILING.MATH) in Microsoft Excel. I understand that i can create a loop that allows me to sequentially compare the value of interest with i and i+1 value. I would like to create an ZPLM operand using rounding, so it seems to me that this way will slow down the optimization, especially with a high degree of rounding accuracy.As an example, we can discuss the case where the value 24.432 needs to be rounded up to 24.0 or 24.5.
Hi! I just started using the ZPL and what I would like to do is to create a solve based on a very simple geometrical relation. But, for doing this, I need to get the Tilt Y of a rectangular object (I am in NS mode).The only think I found is the numeric function NPAR, which it seems to me it only acquires parameters.What would be the right way to do it?Thank you!!!
Good afternoon! I am studying the ZPL macro language in order to simplify the analysis of data in the optimization process. In the macro being developed, I would like to implement the function of sorting optimization operands by their contribution. I know that such information is in the "" section, but I'm interested in the implementation in the ZPL language. There are no problems with the sort itself, I use the IF-THEN conditions in sequence, however, I cannot find a way to display the name of the operand by its ID code. Initially, I thought that the numerical function OPER(…,1) could give me the name of the operand in the string, however, as it turns out, this numeric function returns the ID code of the operand. Could you help me? Thanks
I had a post in Chinese but maybe this helps more people who wants to simulate the tolerance of their systems using ZPL. 如何使用ZPL改变POP中的beam和fiber数据 | Zemax CommunityThe MODIFYSETTING can be applied on the .CFG which has the same name of your design file and locates under the same directory of your file. This is the file that the POPD reads. You have to manually click the SAVE button to generate this file first. If we modify the POP.CFG, it does not work.Here is the sample ZPL code.popCFG$ = "C:\Users\Desktop\Fiber Coupling.CFG"MODIFYSETTINGS popCFG$, POP_FPARAM1, 0.005MODIFYSETTINGS popCFG$, POP_FPARAM2, 0.005OPENANALYSISWINDOW POP, popCFG$PRINT MFCN()The OPENANALYSISWINDOW may not be necessary for certain users. When I run the test, I need this line to activate the modification on this CFG file.
Hi,I would like to read several numeric data as well as text data from a .dat-file into a zpl macro to use some of them for further use.For example, the .dat file has 5 rows and 3 lines, divided by Tabs, e.g.:Pos1 3.7 4.2 6.2 8.7Pos2 9.0 7.5 2.8 5.6Pos3 0.5 1.8 4.6 4.3Is it possible to use the READ command for reading the complete .dat-file and to select afterwards some special data for further optimization?Or would it be possible to read only some special data from the .dat-file for further use, e.g. (Row2, Line 2 = 9.0) and (Row3, Line 3 =1.8)? Best regardsRalf
Hi,I am facing an issue when I try to extract ray trace data for a non sequential component in mixed mode of Zemax. In the above data, I want to get the direction cosines of normal and incident ray for NSC object 7 and 2 using a ZPL macro (as I am tracing a 10000 rays). Since for RANX(surface) (Surface number in the sequential editor has to be given) I don’t know which surface number has to given for this case. I also tried to save the ray trace data every time I trace the ray, but When I run RAYTRACE hx,hy,px,py,wav, (for different px and py), somehow the data in the Raytrace text is not getting update. Can you please provide me a solution for this.
Is it possilbe to use target values from a merit function in a zpl macro.For example, there are some defined constraints in the optical path length (OPTH) for e.g. 5 different ray deflections (different Hx or Hy) of an imaging system. Can I use these fixed values in the ZPL macro for further optimization?
I use Detectorviewers in text mode to export the results of my simulations to disk.Futher processing is done via python, where the plain textfile gets parsed.I prefer to not using the ZOS API as this limits me in the python verison i use. Problem is: The Detector Viewer numbers are really error-prone as sometimes i close a window and open another one and the numbers i have to put into SAVEWINDOW keyword are just wrong by then.I would prefer using the detector number instead using SAVEDETECTOR keyword. But this saves in some binary format i did not find any specs upon for reading that in. Is there any description on the DDR/DDx file format?Is there any way to obtaining the detector data into python? Best regardsOlli
I would like to write the Macro script of ZPL about how to optimize the POP by merit function like as “POPD” optimized operand1.Set the one surface of Thickness or parameter 1,2,3… as the value of 0.5mm, 0.6mm , 0.7mm to run a loop2.Set the someone surface “Thickness or parameter 1,2,3…..” as variable factor. 3.Execute to optimize the MF as POPD to run 10,15 circles as you want 4.In the end, shows the final optimized value to 1st step different cases you setEx. Surface 3 thickness as 0.5mm, 0.6mm, 0.7mmOptimized the surface 7 of thickness as variable factor by using POPD MFto get value under surface 3 as 0.5mm, 0.6mm, 0.7mm respectively.
I am looking for ZPL command which change NSQ parameter solve from pickup to fixed(off).There is command SOLVETYPE and code PF_p to remove pickup for sequential but this option not available for NSQ parameter pick up. Any suggestion how to do so?
Hi all,I’m facing a problem of applying ‘Chief ray solve’ for multiple configurations inside the multi-configuration editor. I was trying to use ‘Chief ray solve’ for Decenter and Tilt to one configuration and let other configurations ‘pick up’ the value of the first one. However, the ‘Chief ray solve’ for Decenter and Tilt in multi-configuration is grayed out. So I was wondering whether it is possible to create a ZPLM solve that is identical to the ‘Chief ray solve’ used in the lens data editor and applies it into the multi-configruaton editor? If this is possible, can anyone shares the logic behind the implementation of ‘Chief ray solve’ for decenter and tilt? ThanksBest wishes and Happy new year! Daoming
Question1: I use ZPLM+MACRO to calculation edge spread size, and tolerance script to get tolerance result for edge spread size variation. But CPU only use 10%, so the computation time is very long. Even I choose the max core in tolerance analysis. Is there any setting I miss for macro operation to make better use of CPU? Question2: When I open Zemax file, it become very slow and need to waiting a long time to see it full open already. Why this issue happen? It was open fast before, and I use the same Zemax file on same computer.
Hi,In a ZPL macro one can get the object number that’s calling the macro as solve with SOSO(1), but how do I get which column that’s calling the ZPL macro?I want to use the same macro for solving both the Z and the Y position of an object so I don’t need maintain two separate macros.Regards,Hans
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.