Find out how you can save time and energy using the Zemax Programming Language!
- 136 Topics
- 365 Replies
Feature Request: Add Data 40 to NSRA to report the Face Number
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.
Macro for finding the active surfaces in one configuration given multiple configurations
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
Saving detector series data / img with ZPL
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.
Getting the Clear Aperture values from the surface names using a ZPL macro
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
Geometric ESF vs FFT ESF
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?
CodeV to Zemax conversion
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
Change a detector position on Z-axis using SETNSCPOSITION
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
Exporting volume detector data
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?
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'.
Saving ray data ZRD to a file in a loop
Hello together,I’m trying to save Ray Database ZRD to a file in a loop for each angle in the following script:...for angle, -10, 10, 2 x = NSDD (1,0,0,0) SETNSCPOSITION 1,2,6,angle PATHRAY$ = "Rayfile_" + $Str(angle) + ".ZRD" NSTR 1,0,1,1,1,1,1,1,PATHRAY$,"h133",1 UPDATE ALL PAUSE THREADSNEXT This just a part of my script, and exactly this part, namely the saving of ray database is not working. How can I save it, so I could have a few Ray Database files for different angles and open it later with the Ray Database Viewer? What is wrong here?Thank you in advance!CheersMax.
Saving an image from Geometric Bitmap Image Analysis for different configuration
Hello, I would like to use a macro to save images from Geometric Bitmap Image Analysis for different configuration.I wrote this macro in ZPL to save the images obtained for different configurations but it doesn’t work:! Read the # of configsNCONFIG = NCON()!Read pathsettingfiles$ = "...\Zemax\Configs\IMB.CFG"! Execute for each configFOR i, 1, NCONFIG, 1 ! Set config SETCONFIG i img_file$ = $STR(i) + ".png" MODIFYSETTINGS settingfiles$, GBM_OUTPUT, img_file$ OPENANALYSISWINDOW "IBM" PAUSE THREADS NEXTPRINT "DONE!"The configuration changes and the Geometric Bitmap Image Analysis window opens up and displays the right image but nothing is saved. Moreover, the output file name keeps the initial name and it isn’t modifying for each configuration. Do you have any idea to save those images ? (the folder path doesn’t matter) I also wrote another ZPL macro which works and saves the image of the opened window following the different configuration but it still not really what
A question about create automatically optimization wizard table by ZPL
HiI'm trying coding a ZPL script to create an automatic optimization wizard table.My target optimization wizard table was show as below picture. Here is producing optimization wizard table by running my ZPL script.Unfortunately, they have three differences by comparing the two created optimization wizard tables and making numbers on the above pictures. Here is a list of the parameter value for differences. This is show the partial screenshot of my ZPL script, the code also attached to set Merit Function.zip. What kind the command settings/paraments were missing in this ZPL script? That can be fixed for the three differences.
Simulating PTFE Integrating Sphere
Hello,I’m trying to simulate a PTFE Integrating Sphere using the predefined macro that we can find in sample files ...\Zemax\Samples\Non-sequentional\Miscellaneous\Integrating Sphere.zmxI was able to change dimension of sphere and port but im finding the following problem:1. How can I change the material MIRROR in PTFE?2. Can I inserti a material inside the sphere?3. How Can I calculate the number of refraction inside the sphere and the number of photons that reach the detector?4. How Can I simulate the Homogeity inside the Sphere?5. The detector viewer doesnt work, how me always the same results….Why?A guide about simulating an integrating sphere can help me so much...Thanks for the support.The code is as attachments.Best Regards.
How to use the GETTEXTFILE function with an NSC detector
Is there a way to to use the GETTEXTFILE function with an NSC detector? I’m running into the same issue, and couldn’t figure it out from the help page of the function. I’m currently using SAVEWINDOW from a detector window opened to the text tab and getting the same message.[Mod note: moved the post to a new forum thread.]
ZOS-API Setting Pick Ups
Does anyone have an example of setting pickups via the ZOS api in NSC mode?for i in obj_list: obj = NCE.GetObjectAt(i) obj.Xposition.SetPickupfromObject(1) ??? something like this I have over 100 lines in the editor I’d like to set to pickup a position off of an existing object, and manually clicking all of them is tedious. Thank you,Jason
Total power and total flux
Hi! I’m calculating the energy inside a surface with LEDS with different detectors: volume detector, sphere as detector, volume pipe as detector… but I can’t get the same values across them… I don’t know why if I hace the same system…From objects as a detector I get total power, but from volume detector total flux (all of them in mW); is this the same?When I take a value from the matrix in volume detector, what is this? flux, power¿?This is my file, I calculate the three detectors individuallyThanks in advance,Carmen
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.