紧急求助:各位同仁们帮助看一下这段程序问题在哪里?
<P>Sub ConnectLine()<BR>Dim mySelect As AcadSelectionSet<BR>Dim MyVal(0 To 3) As String<BR>MyVal(0) = "8": MyVal(1) = "TbRegion": MyVal(2) = "0": MyVal(3) = "REGION"<BR>BuildFilter fType, fDate, MyVal<BR>Set sss = ThisDrawing.SelectionSets<BR>On Error Resume Next<BR>ThisDrawing.SelectionSets.Item("mySelects12").Delete<BR>On Error GoTo ErrExit<BR>Set myss = sss.Add("mySelects12")<BR>myss.Select acSelectionSetAll, , , fType, fDate<BR>Dim myExplode As Variant, En As AcadEntity<BR>For Each En In myss<BR> myExplode = En.Explode<BR> Set mySelect = sss.Add("sRegions5")<BR> mySelect.AddItems myExplode '当前选择集已经添加了对象<BR> <BR> '问题:为什么下一句中P提示前一个选择集合不存在<BR> ThisDrawing.SendCommand "_pedit" & vbCr & "M" & vbCr & "P" & vbCr & vbCr & "Y" & vbCr & "J" & vbCr & vbCr & vbCr<BR> mySelect.Delete<BR>Next<BR>Exit Sub<BR>ErrExit:<BR> MsgBox Err.Description<BR>End Sub</P><P>'创建选择集的过滤规则<BR>Public Sub BuildFilter(typeArray As Variant, dataArray As Variant, ByVal gCodes As Variant)<BR>Dim fType() As Integer, fData() As Variant<BR>Dim Index As Long, i As Long<BR>Index = LBound(gCodes) - 1<BR>'根据gCodes的内容创建过滤数组<BR>For i = LBound(gCodes) To UBound(gCodes) Step 2<BR> Index = Index + 1<BR> ReDim Preserve fType(0 To Index)<BR> ReDim Preserve fData(0 To Index)<BR> fType(Index) = CInt(gCodes(i))<BR> fData(Index) = gCodes(i + 1)<BR>Next<BR>'返回值<BR>typeArray = fType<BR>dataArray = fData<BR>End Sub</P>
页:
[1]