CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

对象捕捉模式属性 (ActiveX)

2023-1-3 09:55| 发布者: admin| 查看: 387| 评论: 0|来自: AutoCAD

摘要: 指定对象捕捉模式的设置。

指定对象捕捉模式的设置。

支持的平台:仅窗口

签名

工 务 局:

object.ObjectSnapMode
对象

类型:文档

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:捕捉模式已打开。
  • False:捕捉模式已关闭。

言论

没有额外的评论。

例子

工 务 局:

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

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 14:30

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部