On Error Resume Next
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.SelectionSets.Item("abcd")
If Err.Number0 Then
Set ss = ThisDrawing.SelectionSets.Add("abcd")
Err.Clear
Else
ss.Clear
End If
我不记得我从哪里得到这个,它可能来自前一阵子与RR的其他网站......或者它可能在其他地方
Dim Mycollection As AcadSelectionSets
Dim SSet1 As AcadSelectionSet
' first check if any ss exist and if they do, delete them
Set Mycollection = ThisDrawing.SelectionSets
For Each SSet1 In Mycollection
If SSet1.Name = "MySS" Then
ThisDrawing.SelectionSets.Item("MySS").Delete
Exit For
End If
Next
我通常将其放在我创建新选择集的部分之前
页:
1
[2]