AllowLongSymbolNames 示例

使用 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