CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2020 开发者帮助

KeyboardPriority 属性 (ActiveX)

2024-5-18 18:21| 发布者: admin| 查看: 91| 评论: 0|原作者: admin|来自: AutoCAD

KeyboardPriority 属性 (ActiveX)

控制 AutoCAD 对坐标数据输入的响应方式。

支持的平台:仅限 Windows

签名

VBA:

object.KeyboardPriority
对象

类型:PreferencesUser

此属性应用于的对象。

属性值

只读:

类型:枚举acKeyboardPriority

  • acKeyboardRunningObjSnap:键入坐标时严格遵守对象捕捉。
  • acKeyboardEntry:键入坐标时严格遵守键盘输入值。
  • acKeyboardEntryExceptScripts:键入坐标时严格遵守键盘输入值。但是,当通过脚本输入坐标时,将遵循正在运行的对象捕捉。

言论

此属性的初始值为 。acKeyboardEntryExceptScripts

注意:此属性的值存储在 OSNAPCOORD 系统变量中。

例子

VBA:

Sub Example_KeyboardPriority()
    ' This example returns the current setting of
    ' KeyboardPriority. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currKeyboardPriority As Integer
    Dim constant As String
    Dim newConstant As String
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current KeyboardPriority value
    currKeyboardPriority = preferences.User.KeyboardPriority
    constant = Choose(currKeyboardPriority + 1, "acKeyboardRunningObjSnap", "acKeyboardEntry", "acKeyboardEntryExceptScripts")
    MsgBox "The current value for KeyboardPriority is " & constant, vbInformation, "KeyboardPriority Example"
    
    ' Change the value for KeyboardPriority
    newConstant = "acKeyboardEntry"
    preferences.User.KeyboardPriority = acKeyboardEntry
    MsgBox "The new value for KeyboardPriority is " & newConstant, vbInformation, "KeyboardPriority Example"
    
    ' Reset KeyboardPriority to its original value
    preferences.User.KeyboardPriority = currKeyboardPriority
    MsgBox "The KeyboardPriority value is reset to " & constant, vbInformation, "KeyboardPriority Example"
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_KeyboardPriority()
    ;; This example returns the current setting of
    ;; KeyboardPriority. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Retrieve the current KeyboardPriority value
    (setq currKeyboardPriority (vla-get-KeyboardPriority (vla-get-User preferences)))
    (setq constant (cond
                     ((= currKeyboardPriority 0) "acKeyboardRunningObjSnap")
                     ((= currKeyboardPriority 1) "acKeyboardEntry")
                     ((= currKeyboardPriority 2) "acKeyboardEntryExceptScripts")))
    (alert (strcat "The current value for KeyboardPriority is " constant))
    
    ;; Change the value for KeyboardPriority
    (setq newConstant "acKeyboardEntry")
    (vla-put-KeyboardPriority (vla-get-User preferences) acKeyboardEntry)
    (alert (strcat "The new value for KeyboardPriority is " newConstant))
    
    ;; Reset KeyboardPriority to its original value
    (vla-put-KeyboardPriority (vla-get-User preferences) currKeyboardPriority)
    (alert (strcat "The KeyboardPriority value is reset to " constant))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 12:48

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部