现在想一次先输出T的数量,然后输出R的数量,请问该怎么改?
Sub co()
Dim SSet As AcadSelectionSet Dim obj As AcadText Dim ptcen(0 To 2) As Double Dim endPoint1(0 To 2) As Double Dim endPoint2(0 To 2) As Double Dim cline As AcadLine Dim lineHalfLength As Double Dim groupCode(0 To 4) As Integer Dim dataValue(0 To 4) As Variant Dim i As Integer On Error Resume Next If Not IsNull(ThisDrawing.SelectionSets.Item("tex")) Then Set SSet = ThisDrawing.SelectionSets.Item("tex") SSet.Delete End If Set SSet = ThisDrawing.SelectionSets.Add("ArcsCirclesEllipses") '设置选择过滤器 groupCode(0) = -4 dataValue(0) = "<or" groupCode(1) = 0 dataValue(1) = "0" groupCode(2) = 0 dataValue(2) = "text" groupCode(3) = 0 dataValue(3) = "0" groupCode(4) = -4 dataValue(4) = "or>" '提示用户选择 ThisDrawing.Utility.Prompt "选择" & vbCr SSet.SelectOnScreen groupCode, dataValue For Each obj In SSet If obj.TextString = "T" Then i = i + 1 End If obj.Update MsgBox "共有T" & i If obj.TextString = "R" Then i = i + 1 End If obj.Update MsgBox "共有R" & i Next obj End Sub
|