Specifies the status of snap.
Supported platforms: Windows only
Read-only: No
Type: Boolean
SnapOn activates Snap mode using the current snap grid resolution, rotation, and style. To change the snap grid resolution, use the SetSnapSpacing method. To change the snap rotation, use the SnapRotationAngle property.
The snap grid is invisible. Use the GridOn property to display a separate visible grid.
AutoCAD ignores the Snap mode in perspective views.
VBA:
Sub Example_SnapOn() ' This example toggles the setting of SnapOn. Dim viewportObj As AcadViewport ' Set the viewportObj variable to the activeviewport Set viewportObj = ThisDrawing.ActiveViewport ' Display the current setting of SnapOn MsgBox "Snap mode is: " & IIf(viewportObj.SnapOn, "On", "Off"), , "SnapOn Example" ' Toggle the setting of SnapOn viewportObj.SnapOn = Not (viewportObj.SnapOn) ' Reset the active viewport to see the change on the AutoCAD status bar ThisDrawing.ActiveViewport = viewportObj MsgBox "Snap mode is now: " & IIf(viewportObj.SnapOn, "On", "Off"), , "SnapOn Example" End Sub
Visual LISP:
(vl-load-com) (defun c:Example_SnapOn() ;; This example toggles the setting of SnapOn. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Set the viewportObj variable to the activeviewport (setq viewportObj (vla-get-ActiveViewport doc)) ;; Display the current setting of SnapOn (alert (strcat "Snap mode is: " (if (= (vla-get-SnapOn viewportObj) :vlax-true) "On" "Off"))) ;; Toggle the setting of SnapOn (vla-put-SnapOn viewportObj (if (= (vla-get-SnapOn viewportObj) :vlax-true) :vlax-false :vlax-true)) ;; Reset the active viewport to see the change on the AutoCAD status bar (vla-put-ActiveViewport doc viewportObj) (alert (strcat "Snap mode is now: " (if (= (vla-get-SnapOn viewportObj) :vlax-true) "On" "Off"))) )