CAD obtain all entities (com VB Interface Language) on Layer 0

The main use of Function:


IMxDrawSelectionSet::Select


Configuration selection set. Details are as follows:


parameter Explanation

[in] MCAD_McSelect Mode

Construction mode selection set

[in] VARIANT point1

Configuration at the selected time required to select the object set point

[in] VARIANT point2

Configuration at the selected time required to select the object set point

[in,optional] VARIANT filterData

Filter set selection data structure

You can take the following values

mcSelectionSetWindow = 0, mcSelectionSetCrossing = 1, mcSelectionSetFence = 2, mcSelectionSetPrevious = 3, mcSelectionSetLast = 4, mcSelectionSetAll = 5, select all entities FIG surface mcSelectionSetWindowPolygon = 6, mcSelectionSetCrossingPolygon = 7, mcSelectionSetUserSelect = 8 mcSelectionImpliedSelectSelect = 9, _I FIG return current the entity that has been selected


Code is implemented as follows:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
   '设置过滤条变量
Dim filter As MxDrawResbuf
Set filter = New MxDrawResbuf
' 把图层名 "0" 作为过滤条件
filter.AddString "0" , 8
 
'定义选择集对象
Dim ss As MxDrawSelectionSet
Set ss = New MxDrawSelectionSet
 
' 选择图上的所有实体,过滤条为filter
ss.Select 5, , , , filter
 
' 遍历选择集中的实体
Dim i As Integer
 
i = 0
Do While i < ss.Count
     Dim ent As MxDrawEntity
     Set ent = ss.Item(i)
     MsgBox ent.Layer
     i = i + 1
Loop

Guess you like

Origin www.cnblogs.com/yzy0224/p/11004342.html