Public Sub creatselectionset()
Dim s1 As AcadSelectionSet
On Error Resume Next
Set s1 = ThisDrawing.SelectionSets("newselectionset")
If Err Then
Err.Clear
Set s1 = ThisDrawing.SelectionSets.Add("newselectionset")
End If
s1.Clear
MsgBox "新添加的选择集名称为" & s1.Name, vbInformation, "selectionsets example"
End Sub
判断选择集是否存在,存在时创建会出错。