谢谢楼上的,A和B的文字内容是一样的,想修改A的文字内容时,B的文字内容变得和A一样。用查找替换是可以同时改变A和B的文字内容,但也会同时把文字内容与A和B相同的其它文字同时改掉,这是我所不希望的。我在网上查阅了些解决办法,要二次开发,我对LISP不懂,所以求助天正软件开发人员解决这个问题。我在网上查到的解决方案如下:
利用AcadDocument_ObjectModified事件实现
Private pJudge As Boolean
Sub Test()
Dim pText(1) As AcadText
Dim pnt(2) As Double
Set pText(0) = ThisDrawing.ModelSpace.AddText("ABC", pnt, 5)
pnt(1) = 10
Set pText(1) = ThisDrawing.ModelSpace.AddText("ABC", pnt, 5)
Dim xt(1) As Integer, xd(1)
xt(0) = 1001: xd(0) = "TlsTest"
xt(1) = 1000: xd(1) = "OK"
pText(0).SetXData xt, xd
pText(1).SetXData xt, xd
End Sub
Private Sub AcadDocument_ObjectModified(ByVal Object As Object)
On Error Resume Next
Dim xt, xd
Dim ss As AcadSelectionSet
Dim ft(0) As Integer, fd(0)
If Not pJudge Then
pJudge = True
Object.GetXData "TlsTest", xt, xd
If IsArray(xd) Then
ThisDrawing.SelectionSets("TlsTest").Delete
Set ss = ThisDrawing.SelectionSets.Add("TlsTest")
ft(0) = 1001: fd(0) = "TlsTest"
ss.Select acSelectionSetAll, , , ft, fd
For Each i In ss
i.TextString = Object.TextString
Next i
End If
pJudge = False
End If
End Sub
如何实现,我不会啊