请问vba如何实现选择图层为"aa",块名不是"405"的所有图元
<p> 请问vba如何实现选择图层为"aa",块名不是"405"的所有图元</p><p> 事实上,"aa"层中只应该有块名是“405”的块,我是要把除块名为"405"的其它块选出来标识错误。 </p><p> 这个选择语句如何实现</p> <p>dim II as integer</p><p>Dim gpCode(0 To 0) As Integer<br/> Dim DateValue(0 To 01) As Variant<br/> gpCode(0) = 0<br/> DateValue(0) = <font color="#ff0000"> LayName'图层名自己输入</font><font color="#ff0000"><br/></font> Dim Filtertype As Variant, FilterDate As Variant<br/> Filtertype = gpCode<br/> FilterDate = DateValue<br/> Dim SSetObj As AcadSelectionSet<br/> <br/> If ThisDrawing.SelectionSets.Count <> 0 Then<br/> For II = 0 To ThisDrawing.SelectionSets.Count - 1<br/> Set SSetObj = ThisDrawing.SelectionSets.Item(II)<br/> SSetObj.Delete<br/> Next<br/> End If<br/> <br/> Set SSetObj = ThisDrawing.SelectionSets.Add("AA")<br/> SSetObj.Select acSelectionSetAll, , , Filtertype, FilterDate'这是选择指定图层上所有的物体</p><p> Dim BLK As AcadBlockReference<br/> For II = SSetObj.Count - 1 To 0 Step -1<br/> If SSetObj.Item(I).ObjectName = "AcDbBlockReference" Then<br/> Set BLK = SSetObj.Item(I)<br/> If BLK.Name <> "405" Then<br/> '自己写要操作的代码</p><p> End If<br/> <br/> End If<br/> Next<br/></p><p></p><p><br/></p> <p> Set BLK = SSetObj.Item(I)<br/> If BLK.Name <> "405" Then<br/></p><p> 好顶一下</p> <p> Dim FilterType(2) As Integer<br/> Dim FilterData(2) As Variant<br/> <br/> <br/> FilterType(0) = 8</p><p> FilterData(0) = "aa"</p><p> FilterType(1) = -4</p><p> FilterData(1) = "/=" '不是 <br/> FilterType(2) = 2<br/> FilterData(2) = "块名" '块名 </p><p>这样应好一些<br/> </p>
页:
[1]