GetVariable Method (ActiveX)

Gets the current setting of an AutoCAD system variable.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetVariable(Name)
object

Type: Document

The object this method applies to.

Name

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).

Return Value (RetVal)

Type: Variant

The value of the specified system variable.

Remarks

For a list of all the AutoCAD system variables and their types, please refer to "System Variables" in the AutoCAD Help system.

Examples

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)))
)