如何向集合里面加东西亚???
aaa是选择集的名称,第二次是因为aaa已经存在了,所以会出错! 这样写代码,第一种方法:Sub a()
Dim n As Integer
n = ThisDrawing.SelectionSets.Count
While (n > 0)
If ThisDrawing.SelectionSets.Item(n - 1).Name = "aaa" Then
ThisDrawing.SelectionSets.Item(n - 1).Delete
n = n - 1
End If
Wend
Dim aa As AcadSelectionSet
Set longSelectionSet = ThisDrawing.SelectionSets.Add("aaa")
longSelectionSet.SelectOnScreen
End Sub第二种方法:
Sub a()
On Error Resume Next
Dim longSelectionSet As AcadSelectionSet
ThisDrawing.SelectionSets("aaa").Delete
If Error Then
Err.Clear
End If
Set longSelectionSet = ThisDrawing.SelectionSets.Add("aaa")
longSelectionSet.SelectOnScreen
End Sub 乐筑天下函数里有创建空的选择集的函数 已经有出错处理 你可以看看
页:
[1]