Numeric Functions
Numeric functions can be used on the right hand side of a numeric variable assignment, and in expressions which are arguments to keywords. These functions may require no arguments, one argument, or multiple arguments. All functions return a single value. Certain functions, such as PWAV() (primary wavelength) , return a value which does not depend upon the argument, and therefore it is not required to provide one. The parentheses however, are still required.
In the following table, all ZPL functions are listed. If the syntax is given as FUNC(), then no arguments are required. FUNC(x) indicates one argument is required, FUNC(x,y) indicates two arguments, etc.
ZPL FUNCTION LISTING
Function | Argument | Return value |
ABSO(x) | Numeric expression | The absolute value of the expression. |
ACOS(x) | Numeric expression | Arc cosine in radians. This function can be used to define the constant pi: π = 2*ACOS(0). |
APMN(x) | Valid surface number | The minimum radius value. For spider apertures, this is the width of the arms. For rectangular and elliptical apertures, it is the x-half width of the aperture. |
APMX(x) | Valid surface number | The maximum radius value. For spider apertures, this is the number of arms. For rectangular and elliptical apertures, it is the y-half width of the aperture. |
APOI(px, py) | Normalized pupil coordinates | Ray intensity apodization factor. |
APXD(x) | Valid surface number | The aperture x-decenter value. |
APYD(x) | Valid surface number | The aperture y-decenter value. |
APTP(x) | Valid surface number | An integer code describing the aperture type on the specified surface. |
ASIN(x) | Numeric expression | Arc sine in radians. |
ASPR() | (null) | Aspect ratio of the current graphics device. |
ATAN(x) | Numeric expression | Arc tangent in radians. |
ATYP() | (null) | System aperture type code: 0 for EPD, 1 for F/#, 2 for NA, and 3 for float by stop size. |
AVAL() | (null) | System aperture value. |
CALD(i) | index | Returns a numeric value from the CALLMACRO buffer at the specified index. See " Calling a Macro from within a Macro " |
CHZN(x) | Valid Surface Number | Chip Zone of surface. |
CONF() | (null) | Returns the current configuration number, which is between 1 and the number of configurations, inclusive. |
CONI(x) | Valid surface number | Conic constant of the surface. |
COSI(x) | Numeric expression in radians | Cosine of the expression. |
CURV(x) | Valid surface number | Curvature of the surface. |
EDGE(x) | Valid surface number | Edge thickness at the clear semi-diameter or semi-diameter of that surface. |
EOFF() | (null) | End of file flag. Returns 1 if the end of file has been reached, otherwise returns 0. Only valid after execution of READ keyword. |
ETIM() | (null) | The elapsed time in seconds since last TIMER. |
EXPE(x) | Numeric expression | e to the power of the expression. |
EXPT(x) | Numeric expression | 10 to the power of the expression. |
FICL(vec#) | Vector #, between 1 and 4 inclusive.. | The fiber coupling efficiency. See "Using the FICL() function". |
FLDX(x) | Valid field number | X-angle or height of specified field. |
FLDY(x) | Valid field number | Y-angle or height of specified field. |
FTAN() | Valid field number | Tangential Angle of specified field. |
FTYP() | (null) | Returns 0 if the current field type is angles in degrees, 1 if object height, 2 if paraxial image height, 3 if real image height, and 4 if theodolite angles. Heights are always in lens units . |
FVAN(x) | Valid field number | Vignetting angle of specified field. This command is obsolete. See FTAN(). |
FVCX(x), FVCY(x) | Valid field number | Vignetting compression x or y of specified field. |
FVDX(x), FVDY(x) | Valid field number | Vignetting decenter x or y of specified field. |
FWGT(x) | Valid field number | Field weighting of specified field. |
GABB(x) | Valid surface number | The glass catalog Abbe number of the glass for the specified surface. |
GAUS(x) | Standard deviation | Returns a random value with a Gaussian distribution, zero mean, and the specified standard deviation. |
GETT(window, line, column) |
The window number, line number, and column number of the numerical value to extract. Columns are delimited by spaces and tab characters. |
Extracts a numerical value from any open text window. This feature allows computations using any value OpticStudio can display in a window. This function assumes that a period is the decimal separator. To use the character currently selected in Windows settings, use GETL(). |
GETL(window, line, column) | The window number, line number, and column number of the numerical value to extract. Columns are delimited by spaces. | Extracts a numerical value from any open text window. This feature allows computations using any value OpticStudio can display in a window. This function uses the decimal separator defined in the Windows "Region and Language" settings . Also see GETT(). |
GIND(x) | Valid surface number | The glass catalog d-light index of the glass for the specified surface. |
GLCA(x) | Valid surface number | Global vertex x vector of the specified surface. |
GLCB(x) | Valid surface number | Global vertex y vector of the specified surface. |
GLCC(x) | Valid surface number | Global vertex z vector of the specified surface. |
GLCM(surf, item) | Surf must be a valid surface number, item is an integer between 1 and 12. | For item equal to 1-9, the return value is R11, R12, R13, R21, R22, R23, R31, R32, or R33. For item equal to 10-12, the return value is the x, y, or z component of the global offset vector. See "Global Coordinate Reference Surface". |
GLCX(x) | Valid surface number | Global vertex x-coordinate of the specified surface. |
GLCY(x) | Valid surface number | Global vertex y-coordinate of the specified surface. |
GLCZ(x) | Valid surface number | Global vertex z-coordinate of the specified surface. |
GNUM(A$) | Any string variable name | If the string A$ is the name of a valid glass, such as BK7, then GNUM returns the number of the glass in the glass catalog. The glass number can subsequent l y be used by SETSURFACEPROPERTY to set the glass type on a surface. If A$ does not correspond to any glass in the catalog, GNUM returns 0. GNUM returns -1 if the string is "MIRROR". |
GPAR(x) | Valid surface number | The glass catalog partial dispersion coefficient of the glass for the specified surface. |
GRIN(s, w, x, y, z) | Surface #, wavelength #, x, y, and z coordinates | Returns the index of refraction at the specified x, y, z position on surfaces at wavelength number w. Works for gradient and non-gradient media. |
GTEM(code) | For checkbox values, code is 0 for Use Glass Substitution Template, 1 for Exclude Glasses With Incomplete Data, 11 for Standard, 12 for Preferred, 13 for Obsolete, 14 for Special, and 21-26 for Use Relative Cost, CR, FR, SR, AR, and PR, respectively. For numerical values, code is 31-36 for Relative Cost, CR, FR, SR, AR, and PR, respectively. | Returns data from the Glass Substitution Template. Checkboxes return zero for false (unchecked) and any non-zero value for true (checked). |
IMAE(seed) | The seed value | Returns the geometric image analysis efficiency. See the discussion "Geometric Image Analysis". If seed is zero, the same random numbers will be used on every call to IMAE. If seed is not zero, then every call to IMAE will use unique random numbers. |
INDX(surface) | Valid surface number | Index of refraction at the primary wavelength. See ISMS. |
INTE(x) | Numeric expression | Returns the largest integer not greater than the argument. |
ISCS(surface) | Valid surface number | Returns zero if the surface is not composite and one of the surfaces is complete. |
ISMS(surface) | Valid surface number | If the surface is an odd mirror, or follows an odd mirror but is not a mirror, the return value will be one, otherwise the return value is 0. |
LOGE(x) | Positive numeric expression | Log base e of the expression. |
LOGT(x) | Positive numeric expression | Log base ten of the expression. |
LOST(code) | Code is 1 to return lost energy due to errors, or 2 for lost energy due to thresholds. | The lost energy following the most recent NSTR trace. |
LVAL(A$) | Any string variable name | String value. Returns a floating point value of the string A$, in which the current user language settings are employed for interpreting the decimal delimiter in the string. Also see SVAL. |
MAGN(x,y) | x and y are any real numbers | Computes the square root of x squared plus y squared. |
MAXF() | (null) |
The maximum radial angle in degrees, radial object height in lens units, or radial image height in lens units. Which value is returned depends upon if the fields are defined by angle, object height, or image height. Note for field angles: See " Field Type " for more information about normalization and the difference between the max field angle and the max radial angle. |
MAXG() | (null) | The number of glasses currently loaded. |
MCON(row, config, data) | Row (operand number ) ,Configuration number, and data value to extract from the Multi-Configuration Editor. |
Extracts data from any row and configuration of the Multi-Configuration Editor. This function is similar to MCOP with extended capabilities for extracting data. If the row and config number are both zero, MCON returns either the number of operands, the number of configurations, or the active configuration number for data = 0, 1, and 2, respectively. If the row number is between 1 and the number of multi-config operands, and the config number is zero, MCON returns the operand type, integer 1, integer 2, integer 3, and string flag for that specified row, for data = 0 through 4 respectively. The 3 integer values are used for various purposes for different operands, such as surface and wavelength numbers. The string flag is 1 if the operand data is a string value, such as a glass name, or 0 for numerical data. If the row number is between 1 and the number of multi-config operands, and the config number is valid, MCON returns either the numerical value or the string data for that operand. Note that all string data returned by MCON must be extracted with the $buffer command after the call to MCON. For example, the following code sample will place the name of the operand on row 1 in a$: dummy = MCON(1, 0, 0) a$ = $buffer() See also keyword SETMCOPERAND . |
MCOP(row, config) | Row (operand number) and configuration of the Multi -Configuration Editor. | Extracts data from any row and configuration of the Multi-Configuration Editor. A configuration number of zero indicates the current configuration. See also keyword SETMCOPERAND . |
MCSD(x) | Valid Surface number | Mechanical Semi-Diameter of surface. |
MFCN() | (null) | MFCN updates the lens, validates the merit function, updates the merit function, then returns the current merit function value. See OPER. |
NCON() | (null) | Returns the number of configurations. |
NFLD() | (null) | The number of defined fields. |
NOBJ(surface) | Valid non-sequential surface number | The number of defined objects in the non- sequential surface. |
NPAR(surf, object, param) | surf is the surface number, object is the object number, and param is the parameter number of the value to return. | Returns a value from the parameter columns of the non-sequential component editor. See " SETNSCPARAMETER ". |
NPOS(surf, object, code) | surf is the surface number, object is the object number, and code is 1-6 for reference object, x, y, z, tilt x, tilt y, and tilt z position to return, respectively. | Returns a value from the position columns of the non-sequential component editor. See " SETNSCPOSITION ". |
NPRO(surf, object, code, face) | surf is the surface number, object is the object number, code values are as def ined for the SETNSCPROPERTY keyword, and face is the face number |
Returns a numeric or string value from the property pages of objects defined in the non- sequential components editor. For information on the code values, see " SETNSCPROPERTY ". String values may be extracted using the $buffer() function after calling this function with a code that returns string data. For example, to extract the comment column of object 5 from NSC surface 2 use these two commands: dummy = NPRO(2, 5, 1, 0) a$ = $buffer() The value dummy may be ignored. The string variable a$ will contain the object comment. |
NSDC(surf, object, pixel, data) |
The surf value indicates the surface number of non-sequential group. The object number indicates the desired detector. Pixel indicates which pixel value is returned. Data is 0 for real, 1 for imaginary, 2 for the amplitude, and 3 for the coherent intensity. See also "NSTR" |
If the object number corresponds to a detector rectangle object, then the coherent intensity data from the specified pixel is returned. Coherent intensity consists of 4 numbers which are each summed over all incident rays: the real part, the imaginary part, the amplitude, and the coherent intensity. If the pixel number is zero, then the sum of the data for all pixels for that detector object is returned. |
NSDD(surf, object, pixel, data) |
The surf value indicates the surface number of non-sequential group. The object number indicates the desired detector. See the discussion to the right for details on the pixel and data arguments. See also "NSTR". |
If the object number is zero, then all detectors are cleared and the function returns zero. If the object number is less than zero, then the detector defined by the absolute value of the object number is cleared and the function returns zero. If the object number corresponds to a detector rectangle, surface, or volume object, then the incoherent intensity data from the specified pixel is returned. For a full discussion of the pixel and data arguments, see "NSDD". This ZPL function supports the same pixel and data arguments as the NSDD optimization operand. This function does not support specifying a value for the # Ignored argument provided by the NSDD optimization operand, and assumes that the value for # Ignored is always zero. Note that, not like the merit function operand NSDD, this ZPL numeric function NSDD() doesn't support pixel = -14/-15 as there is no way to pass the spatial frequency. For calculating geometric MTF in ZPL, please see GETNSCMTF . |
NSDE(surf, object, pixel, angle, data, wavelength) |
The surf value indicates the surface number of non-sequential group. The object number indicates the desired detector. See the discussion to the right for details on the pixel, angle, data, and wavelength arguments. See also "NSTR". |
If the object number is zero, then all detectors are cleared and the function returns zero. If the object number is less than zero, then the detector defined by the absolute value of the object number is cleared and the function returns zero. If the object number corresponds to a detector color object, then the data from the specified pixel is returned. For a full discussion of the pixel, angle, data and wavelength arguments, see "NSDE" under the optimization operand. This ZPL function supports the same pixel, angle, data, and wavelength arguments as the NSDE optimization operand. This function does not support specifying a value for the # Ignored argument provided by the NSDD optimization operand, and assumes that the value for # Ignored is always zero. |
NSDP(surf, object, pixel, data) |
The surf value indicates the surface number of non-sequential group. The object number indicates the desired detector. See the discussion to the right for details on the pixel and data arguments. See also "NSTR". |
If the object number is zero, then all detectors are cleared and the function returns zero. If the object number is less than zero, then the detector defined by the absolute value of the object number is cleared and the function returns zero. If the object number corresponds to a detector polar object, then the data from the specified pixel is returned. For a full discussion of the pixel and data arguments, see "NSDP" This ZPL function supports the same pixel and data arguments as the NSDP optimization operand. |
NSUR() | (null) | The number of defined surfaces. |
NWAV() | (null) | The number of defined wavelengths. |
OBJC(A$) | Any string variable name | Object with comment. Returns the first non- sequential object number where the comment matches the string A$. The comparison is case insensitive. If no NSC object has the matching comment the function returns -1. |
OCOD(A$) | Any string variable or literal that is the name of a Optic Studio optimization operand. | The optimization operand code number used by the OPEV function. |
ONUM(A$) | Any string variable name |
If the string A$ is the name of a valid optimization operand, such as EFFL, then ONUM returns the id number of the operand. The operand id number can subsequently be used by SETOPERAND to set the operand type in the merit function editor. If A$ does not correspond to any operand name, ONUM returns 0. |
OPDC() | (null) | The optical path difference. Valid only after a RAYTRACE call. OPDC will not return valid data if the chief ray cannot be traced. RAYTRACEX does not support OPDC. |
OPER(row, col) | Row (operand number ) and column (data type) of the Merit Function Editor. |
Extracts data from any row and column of the Merit Function Editor. The row is the same as the operand number; the column is 1 for type, 2 for int1, 3 for int2, 4-7 for data1-data4, 8 for target, 9 for weight, 10 for value, 11 for percent contribution, and 12-13 for data5-data6. To obtain the comment from a BLNK operand, use column number 2. The comment is then placed in the string buffer. For example, to obtain the comment from row 1: dummy = OPER(1,2) a$ = $buffer() The value in the dummy variable may be ignored, and a$ will then contain the comment string. OPER does not update the lens or the merit function, it returns the current data. See also OPEV, MFCN and keyword SETOPERAND . |
OPEV(code, int1, int2, data1, data2, data3, data4) | Code is the optimization operand code (see function OCOD), and int1-int2, and data1-data4 are the defining values for the operand. See Optimization Operands. |
Computes the same value as any optimization operand would, without the need to add the operand to the merit function. This is useful for computing numbers already available from the optimization operands. For example, to compute the EFL from the EFFL operand use this code: C = OCOD("EFFL") E = OPEV(C, 0, 1, 0, 0, 0, 0) Make sure to fill all 7 inputs argument for OPEV. If the optimization operand requires less than 6 parameters use additional 0s as in the example above. See also OPER, OCOD, MFCN and keyword SETOPERAND. Some optimization operands, such as OPGT, only make sense when taken in the context of other operands. OPEV will only work for operands that do not depend upon the presence of prior operands. See also OPEW below. |
OPEW(code, int1, int2, data1, data2, data3, data4, data5, data6) | Code is the optimization operand code (see function OCOD), and int1-int2, and data1-data6 are the defining values for the operand. See Optimization Operands. | This function is very similar to OPEV, the key difference being that OPEW supports two additional arguments. Some optimization operands use up to 6 data values rather than 4. |
OPTH(x) | Valid surface number | The optical path length along the ray to the specified surface. Unlike RAYT and RAYO, OPTH considers the phase added by diffractive surfaces such as gratings, holograms, and binary optics. Valid only after a RAYTRACE call. OPTH will not return valid data if the chief ray cannot be traced. RAYTRACEX does not support OPTH. |
PARM(n,s) | Valid parameter number and surface number | Parameter "n" of surface "s". |
PIXX(A$) | A string variable containing the full path to a BMP, JPG or PNG graphic file. | The number of X-direction pixels in the graphic. |
PIXY(A$) | A string variable containing the full path to a BMP, JPG or PNG graphic file. | The number of Y-direction pixels in the graphic. |
PMOD() | (null) | 0 if paraxial mode is off, else 1. |
POWR(x,y) | x and y are any numbers | Computes the absolute value of x to the power of y. |
PVEX() | (null) | Data5 parameter from the ZPLM optimization operand. |
PVEY() | (null) | Data6 parameter from the ZPLM optimization operand. |
PVHX() | (null) | Data1 parameter from the ZPLM optimization operand. |
PVHY() | (null) | Data2 parameter from the ZPLM optimization operand. |
PVPX() | (null) | Data3 parameter from the ZPLM optimization operand. |
PVPY() | (null) | Data4 parameter from the ZPLM optimization operand. |
PWAV() | (null) | The primary wavelength number. |
RADI(x) | Valid surface number | Radius of curvature of surface. If the surface has an infinite radius, RADI returns 0.0. This possibility must be considered to avoid potential divide by zero errors. |
RAGL(x) | Valid surface number | The global X-direction cosine of the ray following the surface. Valid only after a RAYTRACE or RAYTRACEX call. |
RAGM(x) | Valid surface number | The global Y-direction cosine of the ray following the surface. Valid only after a RAYTRACE or RAYTRACEX call. |
RAGN(x) | Valid surface number | The global Z-direction cosine of the ray following the surface. Valid only after a RAYTRACE or RAYTRACEX call. |
RAGX(x) | Valid surface number | The global x coordinate of the ray intercept. Valid only after a RAYTRACE or RAYTRACEX call. |
RAGY(x) | Valid surface number | The global y coordinate of the ray intercept. Valid only after a RAYTRACE or RAYTRACEX call. |
RAGZ(x) | Valid surface number | The global z coordinate of the ray intercept. Valid only after a RAYTRACE or RAYTRACEX call. |
RAND(x) | Numeric expression | Random floating point number uniformly distributed between 0 and the expression. It is recommend that the RANDOMIZE keyword be called before this function to change the random number seed. In particular, if NSC raytrace operands (NSTR) are being used, RANDOMIZE is required to re-seed the random number generator. |
RANX(x) | Valid surface number | The X-direction cosine of the surface normal. Valid only after a RAYTRACE or RAYTRACEX call. |
RANY(x) | Valid surface number | The Y-direction cosine of the surface normal. Valid only after a RAYTRACE or RAYTRACEX call. |
RANZ(x) | Valid surface number | The Z-direction cosine of the surface normal. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYE() | (null) | The ray-trace error flag, 0 if no error. Valid only after a RAYTRACE or RAYTRACEX call. See the RAYTRACE keyword for details. |
RAYL(x) | Valid surface number | The X-direction cosine of the ray following the surface. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYM(x) | Valid surface number | The Y-direction cosine of the ray following the surface. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYN(x) | Valid surface number | The Z-direction cosine of the ray following the surface. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYO(x) | Valid surface number | The ray optical path length from the previous surface to the specified surface. The optical path length is the path length times the index of refraction, either or both of which may be negative. For rays inside a non-sequential surface, RAYO returns the sum of the path length times the index of refraction of all objects the ray passed through.Valid only after a RAYTRACE or RAYTRACEX call. See also OPTH and RAYT. |
RAYT(x) | Valid surface number | The ray path length from the previous surface to the specified surface. The path length may be negative. Valid only after a RAYTRACE or RAYTRACEX call. See also OPTH and RAYO. For rays inside a non-sequential surface, RAYT returns the sum of the path lengths along all segments. See also RAYO. |
RAYV() | (null) | 0 if ray was not vignetted, else vignetted surface number. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYX(x) | Valid surface number | The X-coordinate of the ray intercept. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYY(x) | Valid surface number | The Y-coordinate of the ray intercept. Valid only after a RAYTRACE or RAYTRACEX call. |
RAYZ(x) | Valid surface number | The Z-coordinate of the ray intercept. Valid only after a RAYTRACE or RAYTRACEX call. |
RELI(f) | Field number | RI for the specified field position. |
SAGG(x,y,z) | x,y are the coordinates in lens units at the surface number z | Computes the sag in lens units at the specified point on the surface. |
SCOM(A$, B$) | Any two string variable names | If the strings are equal, SCOM returns 0. If A$ is less than B$, then SCOM returns a value less than 0; otherwise, a value greater than 0. |
SDIA(x) | Valid surface number | Clear semi-diameter or Semi-diameter of surface. |
SIGN(x) | Numeric expression | Returns -1 if the argument is less than zero, 0 if the argument is zero, and +1 if the argument is positive. |
SINE(x) | Numeric expression in radians | Sine of the expression. |
SLEN(A$) | Any string variable name | Returns the length of the string variable A$. The length is defined as the number of characters in the string variable. |
SOLM(operand, config, code) | Operand is the multi-configuration operand number. Config is the configuration number. Code is 0 for the status, 1 for the pickup configuration number, 2 for the pickup operand row, 3 for the pickup scale, 4 for the pickup offset, 5 for the current numerical or string value of the operand, 6 for the ZPL macro solve name, and 7 for the glass catalog name. Not all codes are used by all solve status types. | The return value is data about the solve type and data for the specified multi configuration operand and configuration. If the code is 0 for status, the returned value is 0 for fixed, 1 for variable, 2 for pick-up, 3 for thermal pick-up, 4 for ZPL Macro, and 5 for glass substitution solve. String values may be extracted using the $buffer() function after calling this function with a code that returns string data. For more information on the solve data and the meaning of the solve parameters, see Solve Types (multiple configuration editor). |
SOLV(surf, code, param) | Surf is the surface number. Code is 0 for curvature, 1 for thickness, 2 for glass, 3 for conic, 4 for semidiameter, and 5 for TCE. For parameter data, the code is 100 plus the parameter number. For extra data, the code is 300 plus the extra data number. Param is an integer between 0 and 4, inclusive. | The return value is data about the solve type for the specified surface and data. If param is zero, then an integer corresponding to the solve type is returned. For param between 1 and 3, the data is the solve parameters. For param 4, the data is the pickup column number. String values may be extracted using the $buffer() function after calling this function with a code that returns string data. For more information on the solve data and the meaning of the solve parameters, see Solve Types (lens data editor). |
SOSO(code) | Code is 0 to return the surface number o f the macro solve currently executing, or 1 to return the object number. | This function returns the surface number and/or object number of the macro currently being executed as a solve. If the macro is not being used as a solve, these functions return meaningless data. |
SPRO(surf, code) | Surf is the surface number. The code values are as defined for the SETSURFACEPROPERTY keyword. Only integer code values, and not mnemonics are supported. |
Returns a numeric or string value from the property pages or editors of surfaces defined in the lens data editor. For information on the code values, see " SETSURFACEPROPERTY, SURP ". String values may be extracted using the $buffer() function after calling this function with a code that returns string data. For example, to extract the comment column of surface 4 use these two commands: dummy = SPRO(4, 1) a$ = $buffer() The value dummy may be ignored. The string variable a$ will contain the surface comment. Properties where SETSURFACEPROPERTY requires the use of value2 are not supported by SPRO, use SPRX instead. These properties include parameter data, extra data, and coating layer multiplier and index offset values and status. |
SPRX(surf, code, value2) | Surf is the surface number. The code and value2 values are as defined for the SETSURFACEPROPERTY keyword. Only integer code values, and not mnemonics are supported. | This function is similar to SPRO. The key difference is that SPRX supports one additional argument. Only parameters set by SETSURFACEPROPERTY that use the "value2" argument should use SPRX. See " SETSURFACEPROPERTY, SURP " |
SRCN(A$, n) | A$ is any string variable name, n is the nth matching surface number to return. | Surface matching comment #n. Returns the nth surface number where the comment matches the string A$. The comparison is case insensitive. When n is positive, the search is in the forward direction (0 to # of surfaces), and when n is negative the search direction is backwards (# of surfaces to 0). If there are not n matching comments the function returns -1. When n is zero, returns the count of matching surface comments. |
SQRT(x) | Positive numeric expression | Square root of the expression. |
STDD() - obsolete | This function is obsolete, use SRPO instead. | |
SURC(A$) | Any string variable name |
Surface with comment. Returns the first surface number where the comment matches the string A$. The comparison is case insensitive. If no surface has the matching comment the function returns -1. When tolerancing, the SURC function will keep returning the original surface number even if additional surfaces are added automatically. To avoid this behaviour, use the numeric function SRCN instead. |
SVAL(A$) | Any string variable name | String value. Returns a floating point value of the string A$, assuming that the period symbol is the decimal delimiter in the string. Also see LVAL. |
SYPR(code) | The code values are as defined for the SETSYSTMPROPERTY keyword. Only integer code values, and not mnemonics are supported. |
Returns a numeric or string value for the corresponding system data. For information on the code values , see " SETSYSTEMPROPERTY, SYSP ". String values may be extracted using the $buffer() function after calling this function with a code that returns string data. For example, to extract the lens title use these two commands: dummy = SYPR(16) a$ = $buffer() The value dummy may be ignored. The string variable a$ will contain the lens title. Properties where SETSYSTEMPROPERTY requires the use of value2 are not supported by SYPR. |
TANG(x) | Numeric expression in radians | Tangent of the expression. |
Function | Argument | Return value |
TMAS() | (null) |
The total mass in grams of the lens from surface 1 to the image surface. |
THIC(x) | Valid surface number | Thickness of the surface. |
TOLV(op, col) | The integer op is the tolerance operand number, col is the column number in the Tolerance Data Editor. See discussion. |
Returns a numeric or string value from the Tolerance Data Editor. If col is 1, 2, or 3, the return value is the integer 1, 2, or 3 value as used by that operand type. If col is 4 or 5, the min or max value of the tolerance is returned. If col is 6, the "Do Not Adjust During Inverse Tolerancing" flag is returned (1 for checked, 0 for unchecked). If col is 7, the "Ignore this Operand During Tolerancing" flag is returned (1 for checked, 0 for unchecked). If col is 90, the nominal value of the tolerance is returned. If the col value is 0 or 99, the operand type name or operand comment is placed in the buffer string, respectively. For example, to extract the operand name of operand 7 use these two commands: dummy = TOLV(7, 0) a$ = $buffer() The value dummy may be ignored. The string variable a$ will contain the operand name. See also the string functions $TOLOPERAND and $TOLCOMMENT which perform a similar function. |
UNIT() | (null) | Returns 0, 1, 2, or 3, if the current unit type is millimeters, centimeters, inches, or meters, respectively. |
VEC1(x) | Positive subscript value | Returns the value of the array variable at the specified subscript. |
VEC2(x) | Positive subscript value | Returns the value of the array variable at the specified subscript. |
VEC3(x) | Positive subscript value | Returns the value of the array variable at the specified subscript. |
VEC4(x) | Positive subscript value | Returns the value of the array variable at the specified subscript. |
VERS() | (null) | Returns the version of the OpticStudio program. The version is of the form yymmdd. For example, the version for the June 15, 2005 release of OpticStudio will be 050615. |
WAVL(x) | Valid wavelength number | Wavelength in micrometers. |
WINL() | (null) | Returns the number of the analysis window most recent ly opened by the keyword OPENANALYSISWINDOW. |
WINN() | (null) | Returns the number of open analysis windows. |
WWGT(x) | Valid wavelength number | Wavelength weighting. |
XMIN() | (null) | The minimum x-coordinate in the graphics window. |
XMAX() | (null) | The maximum x-coordinate in the graphics window. |
Function | Argument | Return value |
YMIN() | (null) | The minimum y-coordinate in the graphics window. |
YMAX() | (null) | The maximum y-coordinate in the graphics window. |
Next: