Sub Example_Select()
Dim ssetObj As AcadSelectionSet On Error Resume Next Set ssetObj = ThisDrawing.SelectionSets.Add("SSET") If Err <> 0 Then Set ssetObj = ThisDrawing.SelectionSets.Item("SSET") ssetObj.Clear End If Dim mode As Integer Dim obj As AcadEntity mode = acSelectionSetAll
Dim gpCode(2) As Integer Dim dataValue(2) As Variant gpCode(0) = 0 dataValue(0) = "LWPOLYLINE" gpCode(1) = 8 dataValue(1) = "zd" gpCode(2) = 62 dataValue(2) = 1 Dim groupCode As Variant, dataCode As Variant groupCode = gpCode dataCode = dataValue ssetObj.Select mode, , , groupCode, dataCode MsgBox "图中有" & ssetObj.Count & "个图元已加入到选择集SSET中。" For Each obj In ssetObj obj.Highlight True Next End Sub |