Solved

User Defined Surfare shows only 12 Parameters in LDE

  • 29 November 2022
  • 4 replies
  • 62 views

I am new to DLL programming for Zemax. I have an older file using the Fixed-Data 3 standard. This should support 201 parameters. Unfortuneatly in the LDE editor a maximum of 12 Parameter columns are generated even if i define more. Is there a cap of how many parameters can be displayes as input in the LDE? 

icon

Best answer by MichaelH 8 December 2022, 15:38

View original

4 replies

Userlevel 5
Badge +2

Hi Adrian,

Back with FIXED_DATA3, there was something called the Extra Data Editor which took values beyond the default 12 parameters in the Lens Data Editor.  In current versions of OpticStudio, XData1 should equal Param13, XData2 should equal Param14, etc (since there is a Param0, I might be off-by-one in the mapping, but you can easily confirm with a custom DLL).

You can see this with the us_stand.c example; case 7 shows the “safe” data upon loading the DLL.  You can use FD->max_parameter to determine the number of parameters (this should be 12) and FD->max_extradata (I think this goes up to around 240).  You will use FD->param[i] to set the 12 parameters and FD->xdata[i] to set parameters greater than 12.

The Fixed Data has been updated to FIXED_DATA5, which has elimated the Extra Data mapping so everything can be directly manipulated through the FD->param[i] property.  If you’re just starting out, I would suggest using FIXED_DATA5 (the us_arrayeven2.c shows how to use FD5).

And to directly answer your last question, yes, there is a 255 limit cap on the number of parameters (Param0 to Param254).

Hi Michael,

 

thank you for your detailed reply. Is it possible to alter the FD->max_parameter value?  According to the file “usersurf.h” the FIXED_DATA3 format should use 200 parameters and 500 extraData columns. How do i access those 188 additional parameters?

Userlevel 5
Badge +2

Hi Adrian,

You cannot access those values anymore.  When Zemax switched from Z13 to OpticStudio, the developers refactored the internal code and removed the Extra Data parameters.  You are now limited to the FD->max_parameter value.  If you need to use 500 static values for your surface, you can save the data as a text file which is read in when the UDS is first loaded.  However, if you need to optimize on 500 dynamic values, you will not be able to do this.  

I would suggest using the FD5 struct (and the limits of this struct) and not trying to use a deprecated version.

Userlevel 6
Badge +3

If a user needs access to more than 255 parameters for a user-defined surface, and those parameters need to be “dynamic” (so, for example, they can be designated as variables for optimization), then it should be possible to use one or more Data surfaces in combination with a User Defined surface that is based on the FIXED_DATA5 structure.  Each Data surface provides up to 240 extra data values, and a total of 20 Data surfaces can be used, yielding a grand total of 4,800 extra data values. 

 

 

Additional detail can be found here (albeit the discussion centers primarily on the FD4 structure):

 

Regards,

Jeff

Reply