Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an older method I wrote and it is still working in other programs written prior. But when creating a new one, I can not use the same method anymore as it tells me "OpenAs is not a member of ObjectId". Has this changed or am I missing something?
Public Sub BurstAllBlocks()
Dim curDb As Database = Active.Database
Try
Using tr As Transaction = curDb.TransactionManager.StartTransaction()
Dim layoutDbDictionary As DBDictionary = tr.GetObject(curDb.LayoutDictionaryId, OpenMode.ForRead)
For Each layoutDbDictionaryEntry As DBDictionaryEntry In layoutDbDictionary
Dim layout As Layout = CType(layoutDbDictionaryEntry.Value.GetObject(OpenMode.ForRead), Layout)
Dim blkTblRec As BlockTableRecord = tr.GetObject(layout.BlockTableRecordId, OpenMode.ForWrite)
Dim rxClass = RXObject.GetClass(GetType(BlockReference))
Dim blocks = blkTblRec.Cast(Of ObjectId).Where(Function(ent) ent.ObjectClass.IsDerivedFrom(rxClass)) _
.Select(Function(ent) ent.OpenAs(Of BlockReference)(tr, OpenMode.ForRead))
For Each block As BlockReference In blocks
BurstBlocks(tr, block, blkTblRec)
Next
Next
tr.Commit()
End Using
Catch ex As Exception
MessageServices.DisplayError("Error Bursting Blocks!", "Click OK to skip this section and continue.", ex)
End Try
End Sub
Solved! Go to Solution.