Sub dummyExample()
'Lets grab a BlockReference based on a given ObjectId
Dim myBlockRef As BlockReference = findBlockRef(someObjectId)
'AutoCAD allows me to consult/call the properties & methods of the obtained BlockReference after this point
Console.WriteLine(myBlockRef.Name) 'AutoCAD = Ok with this
'Bricscad 'lost' reference to the BlockReference when the transaction in findBlockRef() was closed.
End Sub
'Dummy Function
Public Function findBlockRef(_acadBlockRefId As ObjectId) As BlockReference
Dim returnBlockRef As BlockReference
' Get the current document and database, and start a transaction
Dim acDoc As Document = Bricscad.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
' Lock the document
Using acLckDoc As DocumentLock = acDoc.LockDocument()
' Start a transaction in the new database
Using acTrans = acDoc.TransactionManager.StartTransaction()
returnBlockRef = acTrans.GetObject(_acadBlockRefId, OpenMode.ForRead)
' Commit the transaction
acTrans.Commit()
End Using ' Dispose of the transaction
End Using ' Unlock the document
Return returnBlockRef
End Function