[求助]字符个数计数
<P>现在想一次先输出T的数量,然后输出R的数量,请问该怎么改?</P><P> Sub co()</P>
<P> Dim SSet As AcadSelectionSet<BR> <BR> Dim obj As AcadText<BR> Dim ptcen(0 To 2) As Double<BR> Dim endPoint1(0 To 2) As Double<BR> Dim endPoint2(0 To 2) As Double<BR> Dim cline As AcadLine<BR> Dim lineHalfLength As Double<BR> Dim groupCode(0 To 4) As Integer<BR> Dim dataValue(0 To 4) As Variant<BR> Dim i As Integer<BR> <BR> <BR> On Error Resume Next<BR> <BR> If Not IsNull(ThisDrawing.SelectionSets.Item("tex")) Then<BR> Set SSet = ThisDrawing.SelectionSets.Item("tex")<BR> SSet.Delete<BR> End If<BR> <BR> Set SSet = ThisDrawing.SelectionSets.Add("ArcsCirclesEllipses")<BR> <BR> '设置选择过滤器<BR> groupCode(0) = -4<BR> dataValue(0) = "<or"<BR> groupCode(1) = 0<BR> dataValue(1) = "0"<BR> groupCode(2) = 0<BR> dataValue(2) = "text"<BR> groupCode(3) = 0<BR> dataValue(3) = "0"<BR> groupCode(4) = -4<BR> dataValue(4) = "or>"<BR> <BR> '提示用户选择<BR> ThisDrawing.Utility.Prompt "选择" & vbCr<BR> SSet.SelectOnScreen groupCode, dataValue<BR> <BR> For Each obj In SSet<BR> If obj.TextString = "T" Then<BR> i = i + 1<BR> <BR> End If<BR> <BR> obj.Update<BR> <BR> MsgBox "共有T" & i<BR> If obj.TextString = "R" Then<BR> i = i + 1<BR> <BR> End If<BR> <BR> obj.Update<BR> <BR> MsgBox "共有R" & i<BR> Next obj<BR> <BR> <BR>End Sub<BR></P> <P>你能解释下下这里是什么意思么?</P>
<P>groupCode(1) = 0<BR>dataValue(1) = "0"<BR></P> <P>groupCode(1) = 0<BR>dataValue(1) = "0"</P>
<P>是原过滤器过滤多种数据!<BR></P><BR> <P>没有这种做法:)</P>
<P>groupCode数组表示DXF组码</P>
<P>dataValue数组表示对应组码的数值</P>
<P>组码0表示一个实体的图元类型</P>
<P>关于这些具体可以看看DXF组码的帮助部分</P>
<P>好像上次做过一次的</P>
<P>设置过滤器为</P>
<P>0,"Text",1,"T"</P>
<P>就可以过滤出T的数量</P>
页:
[1]