CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2025 开发者帮助

AllowLongSymbolNames 属性 (ActiveX)

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

AllowLongSymbolNames 属性 (ActiveX)

确定符号名称是否可以包含扩展字符集或超过 31 个字符。

支持的平台:仅限 Windows

签名

VBA:

object.AllowLongSymbolNames
对象

类型:DatabasePreferences

此属性应用于的对象。

属性值

只读:

类型:布尔

  • True:使用扩展符号名称。
  • False:使用受限的符号名称。

言论

此属性的初始值为 。True

扩展符号名称最多可以包含 255 个字符和 A-Z、0-9、空格以及 Microsoft Windows 和 AutoCAD 未用于其他目的的任何特殊字符。

受限制的符号名称最多可以包含 31 个字符和 A-Z、0-9、美元符号 ($)、下划线 (_) 和连字符 (-)。

此属性适用于存储在符号表中的非图形对象(如线型和图层)的名称。

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

例子

VBA:

Sub Example_AllowLongSymbolNames()
    ' This example reads and modifies the preference value that controls
    ' whether symbol names include extended character sets or more
    ' than 31 characters.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.
    
    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant
    
    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences
    
    ' Read and display the original value
    originalValue = ACADPref.AllowLongSymbolNames
    MsgBox "The AllowLongSymbolNames preference is set to: " & originalValue

    ' Modify the AllowLongSymbolNames preference by toggling the value
    ACADPref.AllowLongSymbolNames = Not (ACADPref.AllowLongSymbolNames)
    newValue = ACADPref.AllowLongSymbolNames
    MsgBox "The AllowLongSymbolNames preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AllowLongSymbolNames = originalValue
    MsgBox "The AllowLongSymbolNames preference was reset back to: " & originalValue
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_AllowLongSymbolNames()
    ;; This example reads and modifies the preference value that controls
    ;; whether symbol names include extended character sets or more
    ;; than 31 characters.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Preferences doc))
        
    ;; Read and display the original value
    (setq originalValue (vla-get-AllowLongSymbolNames ACADPref))
    (alert (strcat "The AllowLongSymbolNames preference is set to: " (if (= originalValue :vlax-true) "1" "0")))

    ;; Modify the AllowLongSymbolNames preference by toggling the value
    (vla-put-AllowLongSymbolNames ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AllowLongSymbolNames ACADPref))
    (alert (strcat "The AllowLongSymbolNames preference has been set to: " (if (= newValue :vlax-true) "1" "0")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AllowLongSymbolNames ACADPref originalValue)
    (alert (strcat "The AllowLongSymbolNames preference was reset back to: " (if (= originalValue :vlax-true) "1" "0")))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部