Gets the current setting of an AutoCAD system variable.
Supported platforms: Windows only
VBA:
RetVal = object.GetVariable(Name)
Type: Document
The object this method applies to.
Access: Input-only
Type: String
The name of the variable to return. Must contain a valid system variable name (the case of the characters is not significant).
Type: Variant
The value of the specified system variable.
For a list of all the AutoCAD system variables and their types, please refer to "System Variables" in the AutoCAD Help system.
VBA:
Sub Example_GetVariable()
    ' This example finds the current setting of the
    ' system variable FILLMODE.
    
    Dim sysVarName As String
    Dim varData As Variant
    
    sysVarName = "FILLMODE"
    varData = ThisDrawing.GetVariable(sysVarName)
    MsgBox sysVarName & " = " & varData, , "GetVariable Example"
    
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_GetVariable()
    ;; This example finds the current setting of the
    ;; system variable FILLMODE.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    (setq sysVarName "FILLMODE")
    (setq varData (vlax-variant-value (vla-GetVariable doc sysVarName)))
    (alert (strcat sysVarName " = " (itoa varData)))
)