CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2022 开发者帮助

UpdateMTextAttribute 方法 (ActiveX)

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

UpdateMTextAttribute 方法 (ActiveX)

更新多行文本的属性和属性的多行文本。

支持的平台:仅限 Windows

签名

VBA:

object.UpdateMTextAttribute
对象

类型:属性

此方法应用到的对象。

返回值 (RetVal)

无返回值。

言论

没有其他评论。

例子

VBA:

Sub Example_MTextAttribute()
    ' This example creates an attribute definition in model space.
    ' It then manipulates its MText properties
    
    Dim attributeObj As IAcadAttribute
    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.4
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5.2: insertionPoint(1) = 5.7: 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)
    
    attributeObj.MTextAttribute = True
    attributeObj.MTextAttributeContent = "test content"
    attributeObj.MTextBoundaryWidth = 4.2
    attributeObj.UpdateMTextAttribute
    ZoomAll

End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_MTextAttribute()
    ;; This example creates an attribute definition in model space.
    ;; It then manipulates its MText properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5.2 5.7 0) 
          attHeight 1.4
          attMode (+ acAttributeModeVerify acAttributeModeMultipleLine)
          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-put-MTextAttributeContent attributeObj "test content")
    (vla-put-MTextBoundaryWidth attributeObj 4.2)
    (vla-UpdateMTextAttribute attributeObj)
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 11:34

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部