CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

TagString Property (ActiveX)

2023-1-3 04:50| 发布者: admin| 查看: 156| 评论: 0|来自: AutoCAD

摘要: 指定对象的标记字符串。

指定对象的标记字符串。

支持的平台:仅窗口

签名

工 务 局:

object.TagString
对象

类型:属性,属性引用,弹出菜单,弹出菜单,工具栏,工具栏项

此属性适用的对象。

属性值

只读:不;除了对象PopupMenuToolbar

类型:字符串

对象的标记字符串。

言论

属性,属性引用:此字符串标识属性的每个匹配项。输入除空格或感叹号以外的任何字符。AutoCAD 将小写字母更改为大写字母。

PopupMenu、PopupMenuItem、ToolbarItem:标签或名称标签是由字母数字和下划线 (_) 字符组成的字符串。此字符串唯一标识给定自定义文件中的项。此字符串在创建对象时自动分配,并由 AutoCAD 在内部用于工具栏和菜单标识。大多数开发人员不需要此级别的标识,并且可以安全地忽略该属性。TagString

例子

工 务 局:

Sub Example_TagString()
    ' This example creates an attribute definition in model space.
    ' It then queries the tag string for the attribute, changes
    ' the tag string, and displays the new tag string.
    
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String
    
    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"
    
    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll
    
    ' Find the current tag string for the attribute
    tag = attributeObj.TagString
    MsgBox "The current tag string for the attribute is " & tag, , "TagString Example"
    
    ' Change the tag string for the attribute
    attributeObj.TagString = "UPDATED_TAG"
    attributeObj.Update
    tag = attributeObj.TagString
    MsgBox "The new tag string for the attribute is " & tag, , "TagString Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TagString()
    ;; This example creates an attribute definition in model space.
    ;; It then queries the tag string for the attribute, changes
    ;; the tag string, and displays the new tag string.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0) 
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")
    
    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)
    
    ;; Find the current tag string for the attribute
    (setq tag (vla-get-TagString attributeObj))
    (alert (strcat "The current tag string for the attribute is " tag))
    
    ;; Change the tag string for the attribute
    (vla-put-TagString attributeObj "UPDATED_TAG")
    (vla-Update attributeObj)
    (setq tag (vla-get-TagString attributeObj))
    (alert (strcat "The new tag string for the attribute is " tag))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 03:06

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部