CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

SnapOn Property (ActiveX)

2023-1-3 06:02| 发布者: admin| 查看: 181| 评论: 0|来自: AutoCAD

摘要: 指定快照的状态。

指定快照的状态。

支持的平台:仅窗口

签名

工 务 局:

object.SnapOn
对象

类型:光伏端口视口

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:快照已打开。
  • False:快照已关闭。

言论

SnapOn使用当前捕捉栅格分辨率、旋转和样式激活捕捉模式。若要更改捕捉网格分辨率,请使用该方法。若要更改捕捉旋转,请使用属性。SetSnapSpacingSnapRotationAngle

捕捉网格不可见。使用该属性显示单独的可见网格。GridOn

AutoCAD 忽略透视视图中的捕捉模式。

注意:此属性的值存储在 SNAPMODE 系统变量中。要更改捕捉样式,请使用捕捉样式系统变量。

例子

工 务 局:

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

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 12:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部