請問 使用過濾器 acSelectionSetAll 就不能下過濾條件嗎?
請問 使用過濾器 acSelectionSetAll 就不能下過濾條件嗎?我把 SelectOnScreen 換成 acSelectionSetAll , 後面的FilterType, FilterData好像是不起作用的? 可是看說明應該是可以的啊..
sset.SelectOnScreen FilterType, FilterData
sset.Select acSelectionSetAll, , , FilterType, FilterData
我的想法是要全選 所有叫 DJ_V2 的圖塊, 不過, 目前看來好像要先選出所有圖塊, 再一個個去看是不是DJ_V2 的圖塊
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
On Error GoTo ErrorHandle1
FilterType(0) = 0
FilterData(0) = "insert"
fff:
Set sset = ThisDrawing.SelectionSets.Add("SS1")
sset.SelectOnScreen FilterType, FilterData
'sset.Select acSelectionSetAll, , , FilterType, FilterData
Dim entry As AcadEntity
For Each entry In sset
entry.color = acRed
entry.Update
Next entry
Exit Sub
ErrorHandle1:
ThisDrawing.SelectionSets.Item("SS1").Delete
GoTo fff
end sub
http://bbs.mjtd.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 ghj20122012的微博 Sub SelectionSetFilterTest()
Dim FilterType(0 To 1) As Integer
Dim FilterData(0 To 1) As Variant
Dim sSet As AcadSelectionSet
Dim Entry As AcadEntity
FilterType(0) = 0 '图元类型
FilterData(0) = "INSERT"
FilterType(1) = 2 '图元名称
FilterData(1) = "DJ_V2"
On Error Resume Next
ThisDrawing.SelectionSets.Item("SS1").Delete
Set sSet = ThisDrawing.SelectionSets.Add("SS1")
On Error GoTo 0
'显示整个图形
ThisDrawing.Application.ZoomExtents
'sSet.SelectOnScreen FilterType, FilterData
'Select只能选择图形中可视范围内的实体
sSet.Select acSelectionSetAll, , , FilterType, FilterData
If sSet.Count = 0 Then Exit Sub
For Each Entry In sSet
Entry.color = acRed
Entry.Update
Next Entry
MsgBox "修改了" & sSet.Count & "实体!"
End Sub 上面的程式確實可以用, 太感謝了~~
再請問一下, 如果是動態圖塊呢.....因為我還有動態圖塊....FilterData 那些該怎麼下參數?
剛下了 li 看到圖塊的資訊...
處理碼 = 51285
圖塊名稱: "marks_V2"
匿名: "*U15"
在 點, X= 208.3794Y= 186.6499Z= 0.0000 FilterData(1) = "DJ_V2,marks_V2" 本帖最后由 ghj20122012 于 2013-7-26 17:49 编辑
我新作了一個測試檔(2010格式)
作了一個動態圖塊 "圖界標2"
我想要全選它 , 用上面的參數去下, 抓不到, 我猜是動態圖塊的關係~
https://googledrive.com/host/0B35LzDuPHIVhWlF3eXRPakF0QmM/Drawing3.dwg
用list看動態圖塊多了 "匿名" 這個資訊
處理碼 = 51431
圖塊名稱: "圖界標2"
匿名: "*U16"
页:
[1]