Ready to create a custom lens in OpticStudio? Find the help you need here!
- 60 Topics
- 149 Replies
I was pleased to see the new NSC Source DLL 'SkewRaysCircular.dll' added in the May 19 release (OpticStudio 20.2). We have immediate use for it in modeling our systems. It was inspired by the similar (sequential) User Defined Surface DLLs discussed in Paul Colbourne's webinar and KnowledgeBase Article KA-01772, which allows optimization of generally astigmatic Gaussian beams in Sequential mode. But I was disappointed to see that the new Non-Sequential Source DLL only models CIRCULAR Gaussian beams with no astigmatism, unlike the Sequential capabilities that were supplied by Dr. Colbourne, which accommodate general astigmatism! I suggest updating and replacing SkewRaysCircular.dll with a new, more general, Source DLL, renamed appropriately, e.g., SkewRaysGaussianXY.dll , that DOES support general astigmatism. This would seem simple enough to implement starting from the existing SkewRaysCircular.dll: add new pairs of parameters for WaistX, WaistY, (and/or SIzeX, Siz
Hi, I was trying to calculate the efficiency for user defined surface: us_hologram_kogelnik; I followed the manual and it works fine when the construction is However, when z2=-23, the efficiency reduce significantly and the plot was like: I’ve already move the image surface to the focal plane. I don’t know if it is correct. Please help me.
I am writing a user defined surface DLL, and want to know if I can speed up the DLL by storing specific precomputed values in FIXED_DATA4 or FIXED_DATA5 datasurf values. In my DLL I have several variables (a1, a2, a3 etc) which are affected by the curvature, conic constant, and one of my surface parameters (which will not vary during optimisation). The sag of the surface is a function in x and y, with different powers of x and y multiplied by these variables. eg. a1*x + a2*x*y + ... I may be misunderstanding how the DLL works, but I currently expect that each time it is called it will compute my variables (a1,a2 etc) and then calculate the sag, meaning that it is inefficiently repeating the same calculations many times, where I only need to compute the sag from the variables which are fixed during any raytracing and optimisation. Can I add code on initialisation to store the curvature, conic constant, and param to the data surf values as well as the corresponding variables a1 etc, a
In this forum post, a sample C++ code to read value from a text file in DLL is shared. This is mainly a supplement to the follwoing knowledge base article. The only difference is we will do the similar thing with C++ code to how how to do this in C++ style. How to read a static data file into a user-defined surface In the attachments, a sample code is attached. This code does the same thing as shown in the following forum post. The difference is the diffraction efficiency data is read from a text file. Simulate 2D diffraction grating using customized diffractive DLL We will explain line by line in below. The first thing to do is to define a global variable, which is declared outside of all the functions. As discussed here, during ray-tracing in OpticStudio, the DLL will be called several times. For the global variable, the inside value is unchanged and the DLL can always see the same data in different thread. Our plan is to read data from text file and save it in this global va
In OpticStudio, currently we only support one dimensional grating. However, it's not difficult to simulate 2D grating. Here we will show an example using diffractive DLL.You may compile it with the instructions or use the DLL file attached to this article. Before we start, here are some articles for required background knowledge that we will not repeat in this forum post. How diffractive surfaces are modeled in OpticStudio (KBA) How diffraction ray-tracing is calculated | Zemax Community(forum post) Custom DLLs in OpticStudio: An overview of user-defined surfaces, objects, and other DLL types (KBA) How to compile a User-Defined DLL (KBA) Let's simply open the attached cpp file and observe how it works in non-sequential mode.This example is mainly modified from the built-in sample \Documents\Zemax\DLL\Diffractive\diff_samp_1.c To compile the program as C++ code. We package the functions with extern 'C'. In this example, we only want to return diffraction ray direction and its rel
Zemax has the wonderful ability to add user-defined surfaces and objects, but they have to be compiled by the user into a dll. With the Community version of Visual Studio 2019, does anybody know (a) which components of Visual Studio need to be installed, (b) what settings are needed in order to “Attach to Process…” in order to debug, and (c) what settings are needed to compile routines correctly. The background here is that the user has to look through a set of examples to work out how to do anything, and these are mostly in C, probably from 20 years ago. There are 2 very useful articles about how to compile a dll, and debug a dll, but they are for C++, with no explanation about when and why C++ is needed. Some VS2017 compiler settings are given, but a lot of others are not mentioned, and there is no information about how to install Visual Studio. The ability to debug a file is phenomenal, but they do not attach with VS2017 and VS2019, and there is a message that &ld
Hi, I have a Global Academic Program License for OpticStudio, and from my License Manager I see this license is of type 'Premium' which should give me the possibility to use dll scattering model. I have downloaded one of Luminit's scattering dll and placed it in the correct folder, but nevertheless the model does not appear in the user defined scatter model list! Is this a limitation of the academic license? Thanks, Chiara
I wanted to try out the new diffraction grating DLLs.  Following the example in the knowledge base article, when I get to the point of selecting one of the DLLs I get an error message "Unable to load 'UserParamNames' function from DLL".  The only DLL that seems to work is diff_samp_1.DLL
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.