Hi,
I often see examples of accessing objects without opening a transaction.
This has no reference to a transaction
Dim Ent As Entity = ObjID.GetObject(OpenMode.ForRead)
but when I try to use it in a reactor it jumps to the ObjectModified event and then not back to the continuing code.
I have this in my CommandEnded event
ElseIf e.GlobalCommandName = "EATTEDIT" Then 'Check if DrawingNo changed Dim Ent As Entity = ObjID.GetObject(OpenMode.ForRead) Dim myXdata As Array = Ent.XData.AsArray If myXdata.GetValue(0).value = "TitleBlock" Then
And don't understand why I need to open a transaction to see if it's a Titleblock
What's the difference between
Dim Ent As Entity = ObjID.GetObject(OpenMode.ForRead)
and
Dim Ent As Entity = trans.GetObject(ObjID, OpenMode.ForRead)
Hope someone can help.
Solved! Go to Solution.
Solved by chiefbraincloud. Go to Solution.
@SRSDS wrote:What's the difference between
Dim Ent As Entity = ObjID.GetObject(OpenMode.ForRead)
and
Dim Ent As Entity = trans.GetObject(ObjID, OpenMode.ForRead)
Short answer, there isn't one. You must have an active transaction to call GetObject. Even when you call Objid.GetObject, the Top Level Transaction still handles the object, so if there is no active transaction it will fail.