- UID
- 307531
- 积分
- 57
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-8-12
- 最后登录
- 1970-1-1
|
发表于 2005-8-17 14:33:48
|
显示全部楼层
获取Text或MText对象后,直接取得其各种属性值,包含你所说的插入点、文字串等。
<pre>
Sub START()
On Error Resume Next
Dim ent As AcadEntity
SELECT_TEXT:
ThisDrawing.Utility.GetEntity ent, pciPnt, " >>Select Text or Mtext:"
If Err Then
Err.Clear
End
End If
Dim textObj As AcadText
Dim MTextObj As AcadMText
Dim resStr As String, pnt As Variant
If ent.ObjectName = "AcDbText" Then
Set textObj = ent
resStr = textObj.TextString
pnt = textObj.InsertionPoint
Else
If ent.ObjectName = "AcDbMText" Then
Set MTextObj = ent
resStr = MTextObj.TextString
pnt = MTextObj.InsertionPoint
Else
GoTo SELECT_TEXT
End If
End If
Dim info As String
info = resStr & vbCr
info = info & "Insert point:(" & pnt(0) & "," & pnt(1) & ")"
MsgBox info, vbInformation, "Tsuihan@163.com"
End Sub
</pre> |
|