<CommandMethod("testFilSel")> Public Sub testSelection2()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
'定义过滤条件
'实体类型
Dim value1 As TypedValue = New TypedValue(DxfCode.Start, "LINE")
'图层
Dim value2 As TypedValue = New TypedValue(DxfCode.LayerName, "0")
'Dim value3 As TypedValue = New TypedValue(DxfCode.Color, "1")
Dim values() As TypedValue = {value1, value2}
Dim sfilter As New SelectionFilter(values)
' 返回选择集的用户提示类.
Dim resSel As PromptSelectionResult = ed.SelectAll(sfilter)
' 得到选择集对象.
Dim sSet As SelectionSet = resSel.Value
' 得到选择集中所有对象的ObjectId集合.
Dim ids As ObjectId() = sSet.GetObjectIds()
Using trans As Transaction = db.TransactionManager.StartTransaction()
' 遍历选择集.
For Each sSetEntId As ObjectId In ids
Dim ent As Entity = trans.GetObject(sSetEntId, OpenMode.ForWrite)