- 积分
- 1432
- 明经币
- 个
- 注册时间
- 2002-10-21
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
用的版言前几天的程序,修改块口的文字,但是改了以后,它无法自己更新,只有用regen命令后才会看到更新结果,请问能让它自动更新吗?要怎样来做呢?
AppActivate AcadApp.Caption
Dim Obj As AcadEntity
Dim ObjName As String
Dim ObjInsPnt As Variant
Dim ObjTxt As String
Dim newtxt As String
Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant
Dim HasContextData As String
On Error Resume Next
AcadApp.ActiveDocument.Utility.GetSubEntity Obj, PickedPoint, TransMatrix, ContextData, "选择图块中的文字:"
If Obj.ObjectName = "AcDbMText" Or Obj.ObjectName = "AcDbText" Then
ObjName = Obj.ObjectName
ObjInsPnt = Obj.insertionpoint
ObjTxt = Obj.TextString
AppActivate Me.Caption
Dim prompt As String
prompt = "当前文字内容为: " & Trim(ObjTxt) & vbCrLf & "请输入新文字:"
newtxt = InputBox(prompt, "修改块中文字", Trim(ObjTxt))
Obj.TextString = newtxt
Obj.Update
Else
AppActivate Me.Caption
MsgBox "没有选中文字!", vbOKOnly + vbInformation, "提示"
End If |
|