Skip to main content

For the User defined object DLL, Zemax passes a variable “data” to the function UserObjectDefinition. However, I have not been able to find any documentation on what each element of this array is. The examples provide some of the parameters (for example the CoatingSample.dll file gives the first 15 parameters and a few others up to parameter 34, see the code below from the example). Where can I find documentation to understand what other parameters I have access to from this data structure?

 

The data ZEMAX sends is formatted as follows:
        data2], datat3], datat4] = x, y, z
        data5], data6], data57] = l, m, n
        datab8] = coat group number
        datau9], data/10], data11] = normal nx, ny, nz
        data 12], dataz13] = current and next index of refraction
        datad14] = cosine of normal incidence angle
        data 15] = wavelength in µm
        data20] =  zero flag. Set this to 1.0 to indicate the DLL
        computes the coating data, otherwise, ZEMAX will compute using
        object settings.

        for s polarization:
        datab21] = amplitude reflection real
        datat22] = amplitude reflection imaginary
        datan23] = amplitude transmission real
        datac24] = amplitude transmission imaginary
        for p polarization:
        data 31] = amplitude reflection real
        data/32] = amplitude reflection imaginary
        datad33] = amplitude transmission real
        data34] = amplitude transmission imaginary

 

Mod note: moved to more appropriate forum for DLL-related discussions.]

Hello,

Thanks for your question here on the Community Forums!

You are correct, values are passed between OpticStudio and DLL with a data array, and this array contains all parameter data from the NSC editor and the ray data.

The DLL has two functions, as below:

  • UserParamNames(): returns parameter and face group names
  • UserObjectDefinition(): contains object definition

For the UserParamNames() function the data value passed to the DLL is as follows:

  • Data <= 0: OpticStudio wants name of particular face (i.e. -1 => face 1)
  • Data > 0: OpticStudio wants name of parameter names

On the other hand, for the UserObjectDefinition Function, the data would be the following:

  • Datat1] value indicates what the DLL should compute
    • Datat1] = 0
      • Place total number of triangular facets in Datat10]
      • Indicate if object is volume or shell in Datat11]
      • Indicate if object is diffractive in Datat12]
    • Datat1] = 1: list of triangles that compose tessellation
      • triangle info placed in tri_list array
    • Datat1] = 2: ray intercept and normal vector (after iteration)
      • OpticStudio provides ray coordinates and direction cosines on tessellation; DLL must iterate to exact surface
      • DLL returns path length to exact surface and normal vector at surface intercept point
    • Datat1] = 3: polarization data
    • Datat1] = 4: default/safe parameter values
  • Datat100] indicates the number of data parameters passed to the DLL
  •  Dataa100+] are the values in parameter cells:
    •  DataD101] = parameter 1, DataD102] = parameter 2, etc.
       

You may find further information about NSC object DLLs in the Help system at:
The Setup Tab > Editors Group (Setup Tab) > Non-sequential Component Editor > Non-sequential Geometry Objects > User Defined Object


and in this knowledgebase article:
Custom DLLs in OpticStudio: An overview of user-defined surfaces, objects, and other DLL types – Knowledgebase (zemax.com)
 

For further references, I am attaching a pdf that provides more details about the individual data parameters.

Finally, I would also suggest to take a look at the sample codes EllipticalVolume and HalfCylinder in the \Documents\Zemax\DLL\Objects folder.

Best,
Csilla


Reply