VBnet 返回指定块的实体id
作者:互联网
''' <summary>
''' 返回指定块名的实体id
''' </summary>
''' <param name="db">数据库对象</param>
''' <param name="blockName">块名</param>
''' <returns>返回指定块名的实体id</returns>
<Extension()>
Function GetBlockObjectId(ByVal db As Database, ByVal blockName As String) As List(Of ObjectId)
Dim ObjectIds As List(Of ObjectId) = New List(Of ObjectId)()
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
If Not bt.Has(blockName) Then Return ObjectIds
Dim btr As BlockTableRecord = CType(bt(blockName).GetObject(OpenMode.ForRead), BlockTableRecord)
Dim enumerator As BlockTableRecordEnumerator = btr.GetEnumerator()
While enumerator.MoveNext()
ObjectIds.Add(enumerator.Current)
End While
trans.Commit()
End Using
Return ObjectIds
End Function
标签:Dim,End,ObjectId,指定,ObjectIds,enumerator,VBnet,id 来源: https://blog.csdn.net/laocooon/article/details/119332098