TagString 属性 (ActiveX)
指定对象的标记字符串。 支持的平台:仅限 Windows 签名VBA: object.TagString
属性值只读:不;除了 和 对象PopupMenuToolbar 类型:字符串 对象的标记字符串。 言论Attribute, AttributeReference:此字符串标识属性的每次匹配项。输入除空格或感叹号以外的任何字符。AutoCAD 将小写字母更改为大写字母。 PopupMenu、PopupMenuItem、Toolbar、ToolbarItem:标记或名称标记是由字母数字和下划线 (_) 字符组成的字符串。此字符串唯一标识给定自定义文件中的项。此字符串在创建对象时自动指定,并由 AutoCAD 在内部用于工具栏和菜单标识。大多数开发商不需要这种级别的身份证明,可以安全地忽略该物业。TagString 例子VBA: 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 可视化 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, 2024-12-15 22:32
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.