Hi Matus,
What Kean was explaining is that the numeric values of ObjectIds change for each session, but AutoCAD automatically updates properly stored references to ObjectIds so that they still point to the same object. Handles on the other hand, as you said, do not change.
So you properly store (e.g. in the XRecord he mentioned) an ObjectId 222 in the drawing, close and reopen, if that ObjectId becomes 333 then the XRecord 222 you stored will also have become 333, thus still pointing to the same object. However if you stored 222 in another drawing or as a piece of text (anywhere AutoCAD doesn't know to look for it), then it is still 222 which is no longer valid, or maybe worse now points to something else. But since the handle won't change, you can store it however you want wherever you want and it will always refer to the same object (provided it's still there, etc.).
Hopefully that helps a little and doesn't just add to the confusion...
James
What I did, is that I get the handles of objects in selection set, store them in an XRecord in DBDictionary, and then, when I'm loading them, I get ObjectIDs from those Handles and build SelectionSets using the SelectionSet.FromObjectIds
this works, so I'm fine, but I would like to understand the answer from Kean
I thought, that ObjectIDs are generated every time AutoCAD opens the drawing, while Handles stay the same, then how can I access the same entity from stored ObjectID, when I close/reopen the drawing? While handles should be the same for each entity in every opened drawing, so if I open one drawing twice, than the only way to address the entity in the correct drawing would be to use the ObjectID. Kean seams to be explaining it the opposite way.
So did I misunderstand this answer from him, or did I misunderstand the whole concept of Handles and ObjectIDs?
Sorry to talk about you in third person Kean, I would really appreciate if you could answer this personally.
Matus