简单说一下我的问题:
我的图形里有很多线段,我要通过屏幕选择一部分,然后通过全选的方式选择余下的部分。
我写了部分代码,但是全选的时候出错了,选择不了所有蓝色的直线,请看代码:
-
-
-
- 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) = ""
-
-
- Set J1line = ThisDrawing.SelectionSets.Add("J1")
- Set Hubline = ThisDrawing.SelectionSets.Add("Hub")
- Set Shroudline = ThisDrawing.SelectionSets.Add("Shroud")
-
- AppActivate " 2008"
-
- 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(3) As Integer
- Dim FilterData1(3) As Variant
-
- '以下的过滤代码好像有问题,选择的时候不起作用,选不了蓝色的线,试了好几种情况都不行,把and 去掉也不行,加上也不行!
- FilterType1(0) = -4
- FilterData1(0) = ""
- 'FilterType1(3) = 10
- 'FilterData1(3) = 868#
- 'FilterType1(4) = -4
- 'FilterData1(4) = "and>"
-
-
- 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").DeleteEnd Sub
|