Returns the value of a variant after changing it from one data type to another
(vlax-variant-change-type var type)
The vlax-variant-change-type function returns the value of the specified variable after converting that value to the specified variant type.
- var
- type
-
The type of variant to return, using the value of var (the value of var is unchanged). The type value can be represented by one of the following constants:
vlax-vbEmpty (0) Uninitialized
vlax-vbNull (1) Contains no valid data
vlax-vbSingle (4) Single-precision floating-point number
vlax-vbDouble (5) Double-precision floating-point number
The integer shown in parentheses indicates the value to which the constant evaluates. It is recommended that you specify the constant in your argument, not the integer value, in case the value changes in later releases of AutoCAD.
The value of var, after converting it to the specified variant type; otherwise nil, if var could not be converted to the specified type.
Set a variable named varint to a variant value:
_$ (setq varint (vlax-make-variant 5))
#<variant 3 5>
Set a variable named varintstr to the value contained in varint, but convert that value to a string:
_$ (setq varintStr (vlax-variant-change-type varint vlax-vbstring))
#<variant 8 5>
_$ (vlax-variant-value varintStr)
"5"
This confirms that varintstr contains a string.
-
The vlax-variant-type and vlax-variant-value functions.