指定对象的标记字符串。 支持的平台:仅窗口 属性值只读:不;除了对象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)) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:29
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.