Public ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Public Function objectidtoacadobject(ByVal objid As ObjectId) As AcadObject
Dim obj2 As AcadObject
Dim db = HostApplicationServices.WorkingDatabase
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Dim ent As Entity = trans.GetObject(objid, OpenMode.ForRead, False)
obj2 = ent.AcadObject
Return obj2
End Function