- 错误提示的是命名选择集已存在。
- 问题在此句:Set ss = ThisDrawing.SelectionSets.Add(CStr(Rnd))
- 建议改为这样:Set ss = CreateSelectionSet
- CreateSelectionSet函数定义如下:
- '返回一个空选择集
- Public Function CreateSelectionSet(Optional SelectionSetName As String = "mjtd") As AcadSelectionSet
- On Error Resume Next
- ThisDrawing.SelectionSets(SelectionSetName).Delete
- Set CreateSelectionSet = ThisDrawing.SelectionSets.Add(SelectionSetName)
- On Error GoTo 0
- End Function
|