dim II as integer Dim gpCode(0 To 0) As Integer Dim DateValue(0 To 01) As Variant gpCode(0) = 0 DateValue(0) = LayName'图层名自己输入 Dim Filtertype As Variant, FilterDate As Variant Filtertype = gpCode FilterDate = DateValue Dim SSetObj As AcadSelectionSet If ThisDrawing.SelectionSets.Count <> 0 Then For II = 0 To ThisDrawing.SelectionSets.Count - 1 Set SSetObj = ThisDrawing.SelectionSets.Item(II) SSetObj.Delete Next End If Set SSetObj = ThisDrawing.SelectionSets.Add("AA") SSetObj.Select acSelectionSetAll, , , Filtertype, FilterDate'这是选择指定图层上所有的物体 Dim BLK As AcadBlockReference For II = SSetObj.Count - 1 To 0 Step -1 If SSetObj.Item(I).ObjectName = "AcDbBlockReference" Then Set BLK = SSetObj.Item(I) If BLK.Name <> "405" Then '自己写要操作的代码 End If End If Next
|