CAB, there's something going wrong. The only thing I can get to work is using a Command will start when there's a sssetfirst. Then iterate through all the entities in that selection set, extracting the enames & their xdata into a list (where they're blocks named e.g. "TESTBLOCK").
Then if command completed list that xdata.
I've tried going the OpenedForModify route, but neither entget nor vlax-ename->vla-object gives anything (the later actually exits with error). It's as if nothing else may even read from the entity while it's being edited.
The only way I can see this happening is by searching through the database and extract ALL blocks with their xdata on an Erase command start. Then on the object erased extract that data from the list by assoc'ing on the ename returned. I.e. get the data before it gets locked by the erase command in the first place. And that would make for a very inefficient algorithm! :pissed:
:ugly: ... methinks this might be a job for DotNet rather. Perhaps it's Database.ObjectErased event might just be able to read the data while it's being erased. .... Actually scratch that, from the DBObject class's help:
OpenMode.ForRead | Up to 256 readers can be opened at once, as long as object is not already open kForWrite or kForNotify. Member functions invoked when an object is opened kForRead should not cause object to be modified. |
So it seems even here you cannot open an object to read its data while another process has it open to modify such data.