CodeV to Zemax conversion

  • 19 May 2021
  • 2 replies


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


Best answer by Ethan 20 January 2023, 20:11

View original

2 replies

Userlevel 6
Badge +2

Hi Helen,

Would you be able to share with us your Code V file? I would recommend opening a case with us to continue the conversation. Usually we are able to modify the macro to correct these kinds of issues.


Userlevel 3
Badge +2

For the benefit of others with this problem, here was the fix:

It looks like this error is occurring because one of the string variables has exceeded the number of characters allowed by the ZPL macro.  Specifically, it looks like the error occurred due to the length of the VUX (vignetting factor) string.  Per the help file page on String Variables, string variables can hold a maximum of 360 characters (The Programming Tab > About the ZPL > String Variables).

For ZPL macros, the maximum parse limit for a single parsing operation is 300 characters.  This means that while two strings can be concatenated to create a string variable of max 360 characters, if one string is above 300 characters, the ZPL macro will not be able to parse it.  This explains why the following error popped up: Maximum length for a string variable is exceeded.  Please shorten string and try again.

Since this error is resulting from the vignetting factor string, the easiest way to resolve this would be to go into the .SEQ file in Code V and edit the vignetting factor values directly. If each VUX value was edited such that they all had 2-3 less significant digits, the total characters of the new VUX string should be under the parsing limit. So, my first recommendation would be to open the original Code V file, shorten every VUX value, save a new .SEQ file, and run the new .SEQ file through the Code V to OpticStudio Converter ZPL macro.

If it is not possible to edit the VUX values, another solution would be to edit the Code V to OpticStudio ZPL macro such that it can handle this string. An edit would need to be made such that the macro can recognize when a string exceeds the parsing limit and concatenate it into two separate strings. This would be a much more involved process.