如何让图形处于被选中状态
1个回答
2016-11-29 · 知道合伙人软件行家
关注
展开全部
一段测试代码
<CommandMethod("SSS")> Public Shared Sub 筛选()
Dim dm As DocumentCollection = Application.DocumentManager
Dim ed As Editor = dm.MdiActiveDocument.Editor
'获取当前数据库作为目标数据库
Dim Db As Database = dm.MdiActiveDocument.Database
dm.MdiActiveDocument.LockDocument()
Dim ids() As ObjectId
Dim N As Integer = 0
Using trans As Transaction = Db.TransactionManager.StartTransaction()
Dim bt As BlockTable = trans.GetObject(Db.BlockTableId, OpenMode.ForRead)
Dim btr As BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead)
' 遍历选择集.
For Each EntId As ObjectId In btr
Dim en As Entity = trans.GetObject(EntId, OpenMode.ForRead)
If TypeOf en Is Line Then
ReDim Preserve ids(N)
ids(N) = EntId
en.Highlight()
N = N + 1
End If
Next
ed.SetImpliedSelection(ids)
End Using
End Sub
<CommandMethod("SSS")> Public Shared Sub 筛选()
Dim dm As DocumentCollection = Application.DocumentManager
Dim ed As Editor = dm.MdiActiveDocument.Editor
'获取当前数据库作为目标数据库
Dim Db As Database = dm.MdiActiveDocument.Database
dm.MdiActiveDocument.LockDocument()
Dim ids() As ObjectId
Dim N As Integer = 0
Using trans As Transaction = Db.TransactionManager.StartTransaction()
Dim bt As BlockTable = trans.GetObject(Db.BlockTableId, OpenMode.ForRead)
Dim btr As BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead)
' 遍历选择集.
For Each EntId As ObjectId In btr
Dim en As Entity = trans.GetObject(EntId, OpenMode.ForRead)
If TypeOf en Is Line Then
ReDim Preserve ids(N)
ids(N) = EntId
en.Highlight()
N = N + 1
End If
Next
ed.SetImpliedSelection(ids)
End Using
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询