Si desea referirse a un conjunto de selección cuyo nombre conoce, utilice su nombre. En el siguiente ejemplo, se hace referencia a un conjunto de selección denominado “SS10”:
Sub GetObjInSet()
Dim selset As AcadSelectionSet
Set selset = ThisDrawing.SelectionSets("SS10")
MsgBox ("Selection set " & selset.Name & " contains " & _selset.Count & " items")End Sub
Los conjuntos de selección de un dibujo son miembros de la colección SelectionSets. Se puede utilizar la instrucción For Each para iterar en toda la colección SelectionSets de un dibujo y recoger información acerca de cada conjunto.
Presentación del nombre de los conjuntos de selección de un dibujo
El siguiente código muestra el nombre de todos los conjuntos de selección de un dibujo, junto con el tipo de los objetos incluidos en cada uno.
Sub ListSelectionSets()
Dim selsetCollection As AcadSelectionSets
Dim selset As AcadSelectionSet
Dim ent As Object
Dim i, j As Integer
Set selsetCollection = ThisDrawing.SelectionSets' Find each selection set in the drawingi = 0For Each selset In selsetCollectionMsgBox "Selection set " & CStr(i) & " is: " & selset.Name' Now find each object in the selection set, and say what it isj = 0For Each ent In selsetMsgBox "Item " & CStr(j + 1) & " in " & selset.Name _& "is: " & ent.EntityNamej = j + 1Nexti = i + 1NextEnd Sub