Sub FilterLine()
On Error GoTo ErrorHandle
Dim sslines As AcadSelectionSet
Dim J1line As AcadSelectionSet
Dim Hubline As AcadSelectionSet
Dim Shroudline As AcadSelectionSet
Dim FilterTypeJ1(0) As Integer
Dim FilterDataJ1(0) As Variant
Dim FilterTypeHS(5) As Integer
Dim FilterDataHS(5) As Variant
FilterTypeJ1(0) = 0
FilterDataJ1(0) = "Line"
FilterTypeHS(0) = -4
FilterDataHS(0) = "<or"
FilterTypeHS(1) = 0
FilterDataHS(1) = "POLYLINE"
FilterTypeHS(2) = 0
FilterDataHS(2) = "SPline"
FilterTypeHS(3) = 0
FilterDataHS(3) = "Line"
FilterTypeHS(4) = 0
FilterDataHS(4) = "Arc"
FilterTypeHS(5) = -4
FilterDataHS(5) = "or>"
On Error Resume Next
AppActivate "AutoCAD 2008"
ThisDrawing.SelectionSets("J1").Delete
ThisDrawing.SelectionSets("Hub").Delete
ThisDrawing.SelectionSets("Shroud").Delete
Set J1line = ThisDrawing.SelectionSets.Add("J1")
Set Hubline = ThisDrawing.SelectionSets.Add("Hub")
Set Shroudline = ThisDrawing.SelectionSets.Add("Shroud")
MsgBox "选择J=1计算站"
J1line.SelectOnScreen FilterTypeJ1, FilterDataJ1
J1line.Highlight (False)
MsgBox "J=1计算站对象数:" & J1line.count
MsgBox "选择Hub"
Hubline.SelectOnScreen FilterTypeHS, FilterDataHS
Hubline.Highlight (False)
MsgBox "Hub计算站对象数:" & Hubline.count
MsgBox "选择Shroud"
Shroudline.SelectOnScreen FilterTypeHS, FilterDataHS
Shroudline.Highlight (False)
MsgBox "Shroud计算站对象数:" & Shroudline.count
Dim FilterType1(1) As Integer
Dim FilterData1(1) As Variant
'FilterType1(0) = -4
'FilterData1(0) = "<and"
FilterType1(0) = 0
FilterData1(0) = "Line"
FilterType1(1) = 62
FilterData1(1) = 5
'FilterType1(3) = -4
'FilterData1(3) = "and>"
'FilterType1(3) = 10
'FilterData1(3) = 868#
'FilterType1(4) = -4
'FilterData1(4) = "and>"
On Error Resume Next
Set ss2lines = ThisDrawing.SelectionSets.Add("SSets2")
ss2lines.Select acSelectionSetAll, , , FilterType1, FilterData1
i = ss2lines.count
MsgBox "全部对象数:" & i
'Dim E As AcadEntity
'For Each E In ss2lines
' MsgBox E.ObjectName
' i = 1
' If (i = 1) Then
' End
' End If
' Next E
i = ss2lines.count
MsgBox "所需对象数:" & i
ss2lines.Delete
J1line.Delete
Hubline.Delete
Shroudline.Delete
Exit Sub
ErrorHandle:
ThisDrawing.SelectionSets("J1").Delete
ThisDrawing.SelectionSets("Hub").Delete
ThisDrawing.SelectionSets("Shroud").Delete
ThisDrawing.SelectionSets("SSets2").Delete
End Sub