你要先得到text对象,然后读取它的属性值如下autocad帮助文件中的例子)
Sub Example_TextString()
' This example creates a text object in model space.
' It then returns the text string for that object.
Dim textObj As AcadText '声明
Dim text As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
' Define the text object
text = "Hello, World."
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
height = 0.5
' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height) '赋值
ZoomAll
' Return the current text string for the object
text = textObj.textString '读属性
MsgBox "The TextString property equals: " & text, vbInformation, "TextString Example"
End Sub |