明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1296|回复: 0

Select选择集应用一例

[复制链接]
发表于 2008-6-11 15:27:00 | 显示全部楼层 |阅读模式
采用功能函数实现选择集中对象的增加。
  1. Function CreatSelectionSet(InputEntityObjectName As Variant) As AcadSelectionSet
  2.   On Error Resume Next
  3.   'Dim SSet As AcadSelectionSet
  4.   If Not IsNull(ThisDrawing.SelectionSets.Item("SelectEntity")) Then
  5.     Set CreatSelectionSet = ThisDrawing.SelectionSets.Item("SelectEntity")
  6.     CreatSelectionSet.Delete
  7.   End If
  8.   Set CreatSelectionSet = ThisDrawing.SelectionSets.Add("SelectEntity")
  9.   Pt1 = ThisDrawing.Utility.GetPoint(, "Input First Point")
  10.   Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Input First Point")
  11.   Dim gpCode(0) As Integer
  12.   Dim dataValue(0) As Variant
  13.   gpCode(0) = 0
  14.   For ii = 0 To UBound(InputEntityObjectName)
  15.     dataValue(ii) = InputEntityObjectName(ii)
  16.   Next ii
  17.   CreatSelectionSet.Select acSelectionSetWindow, Pt1, Pt2, gpCode, dataValue
  18. End Function
  19. Sub ReadTable()
  20.   Dim SSet As AcadSelectionSet
  21.   Dim InputEntityObjectName As Variant
  22.   InputEntityObjectName = Array("Text")
  23.   Set SSet = CreatSelectionSet(InputEntityObjectName)
  24.   Dim Ent As AcadEntity
  25.   For Each Ent In SSet
  26.     Debug.Print Ent.ObjectName
  27.   Next Ent
  28. End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 09:54 , Processed in 0.148173 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表