若要引用您知道其名称的现有选择集,请按名称引用它。 以下示例引用名为“SS10:”的选择集 Sub GetObjInSet() Dim selset As AcadSelectionSet Set selset = ThisDrawing.SelectionSets("SS10") MsgBox ("Selection set " & selset.Name & " contains " & _ selset.Count & " items") End Sub 图形中的每个选择集都是集合的成员。可以使用该语句循环访问图形的集合并收集有关每个选择集的信息。SelectionSetsFor EachSelectionSets 显示图形中每个选区集的名称下面的代码显示图形中每个选择集的名称,并列出每个选择集中包含的对象类型: 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 drawing i = 0 For Each selset In selsetCollection MsgBox "Selection set " & CStr(i) & " is: " & selset.Name ' Now find each object in the selection set, and say what it is j = 0 For Each ent In selset MsgBox "Item " & CStr(j + 1) & " in " & selset.Name _ & "is: " & ent.EntityName j = j + 1 Next i = i + 1 Next End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:07
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.