ObjectSnapMode Property (ActiveX)

Specifies the setting of the object snap mode.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSnapMode
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ObjectSnapMode()
    ' This example toggles the setting of the Object Snap Mode.
    
    Dim currObjSnapMode As Boolean
    
    ' Get the current ObjectSnapMode value
    currObjSnapMode = ThisDrawing.ObjectSnapMode
    MsgBox "The object snap mode is currently " & IIf(ThisDrawing.ObjectSnapMode, "on.", "off."), , "ObjectSnapMode Example"
    
    ' Change the default ObjectSnapMode value
    ThisDrawing.ObjectSnapMode = Not (currObjSnapMode)
    MsgBox "The object snap mode is now " & IIf(ThisDrawing.ObjectSnapMode, "on.", "off."), , "ObjectSnapMode Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSnapMode()
    ;; This example toggles the setting of the Object Snap Mode.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Get the current ObjectSnapMode value
    (setq currObjSnapMode (vla-get-ObjectSnapMode doc))
    (alert (strcat "The object snap mode is currently " (if (= (vla-get-ObjectSnapMode doc) :vlax-true) "on." "off.")))
    
    ;; Change the default ObjectSnapMode value
    (vla-put-ObjectSnapMode doc (if (= (vla-get-ObjectSnapMode doc) :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The object snap mode is now " (if (= (vla-get-ObjectSnapMode doc) :vlax-true) "on." "off.")))
)