Returns the value of a variant after changing it from one data type to another
(vlax-variant-change-type var type)
vlax-variant-change-type function returns the value of the specified variable after converting that value to the specified variant type.
TheArguments
A variable whose value is a variant.
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-vbInteger (2) Integer
vlax-vbLong (3) Long integer
vlax-vbSingle (4) Single-precision floating-point number
vlax-vbDouble (5) Double-precision floating-point number
vlax-vbString (8) String
vlax-vbObject (9) Object
vlax-vbBoolean (11) Boolean
vlax-vbArray (8192) Array
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.
Return Values
nil, if var could not be converted to the specified type.
The value of var, after converting it to the specified variant type; otherwiseExamples
varint to a variant value:
Set a variable named_$ (setq varint (vlax-make-variant 5))
#<variant 3 5>
varintstr to the value contained in varint, but convert that value to a string:
Set a variable named_$ (setq varintStr (vlax-variant-change-type varint vlax-vbstring))
#<variant 8 5>
varintstr:
Check the value of_$ (vlax-variant-value varintStr)
"5"
varintstr contains a string.
This confirms thatvlax-variant-type and vlax-variant-value functions.
The