truezhang 发表于 2024-3-2 22:33:06

VBA中,如何可以创建多个选择集

如题,目前看例子只会创建1个,多个就不太清楚怎么创建了

Oceanable 发表于 2024-3-14 23:06:05



static/image/hrline/4.gif


Public Sub CreateSelectionSet(SeleObjts As AcadSelectionSet, Name As String)


On Error Resume Next


If Not IsNull(ThisDrawing.SelectionSets.Item(Name)) Then
Set SeleObjts = ThisDrawing.SelectionSets.Item(Name)
SeleObjts.Delete
End If


Set SeleObjts = ThisDrawing.SelectionSets.Add(Name)


End Sub



static/image/hrline/4.gif


Dim SeleObjts_1 As AcadSelectionSet
         Call CreateSelectionSet(SeleObjts_1, "SeleObjts_1"):    SeleObjts.SelectOnScreen



Dim SeleObjts_2 As AcadSelectionSet
         Call CreateSelectionSet(SeleObjts_2, "SeleObjts_2"):    SeleObjts.SelectOnScreen


Dim SeleObjts_2 As AcadSelectionSet
         Call CreateSelectionSet(SeleObjts_3, "SeleObjts_3"):    SeleObjts.SelectOnScreen

--- 这样可以么 ???





nslove44202489 发表于 2024-4-24 21:30:38

不能太多最多256个

wuyunpeng888 发表于 2024-5-5 15:06:43

本帖最后由 wuyunpeng888 于 2024-5-5 15:08 编辑

用SelectionSets集合对象的add方法创建命名选择集,在图形中最多可创建 128 个命名选择集
页: [1]
查看完整版本: VBA中,如何可以创建多个选择集