兰州人 发表于 2008-6-11 15:27:00

Select选择集应用一例

采用功能函数实现选择集中对象的增加。Function CreatSelectionSet(InputEntityObjectName As Variant) As AcadSelectionSet
On Error Resume Next
'Dim SSet As AcadSelectionSet
If Not IsNull(ThisDrawing.SelectionSets.Item("SelectEntity")) Then
    Set CreatSelectionSet = ThisDrawing.SelectionSets.Item("SelectEntity")
    CreatSelectionSet.Delete
End If
Set CreatSelectionSet = ThisDrawing.SelectionSets.Add("SelectEntity")
Pt1 = ThisDrawing.Utility.GetPoint(, "Input First Point")
Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Input First Point")
Dim gpCode(0) As Integer
Dim dataValue(0) As Variant
gpCode(0) = 0
For ii = 0 To UBound(InputEntityObjectName)
    dataValue(ii) = InputEntityObjectName(ii)
Next ii
CreatSelectionSet.Select acSelectionSetWindow, Pt1, Pt2, gpCode, dataValue
End Function
Sub ReadTable()
Dim SSet As AcadSelectionSet
Dim InputEntityObjectName As Variant
InputEntityObjectName = Array("Text")
Set SSet = CreatSelectionSet(InputEntityObjectName)
Dim Ent As AcadEntity
For Each Ent In SSet
    Debug.Print Ent.ObjectName
Next Ent
End Sub

页: [1]
查看完整版本: Select选择集应用一例