Is there any way to have a user select entities and then save that selection for later use not only in the current drawing session but also for later retrieval in another completely new session and even by someone else? I anticipate the need to save the data out to an external file/database but I am not sure what to save out as I believ the object ids are session dependent.
Any thoughts/ideas/directions are welcome.
Thanks in advance.
Firstly, let's assume, by saying "for later use not only in the current drawing session but also for later retrieval in another completely new session and even by someone else", you mean running the same custom program/code in the same AutoCAd session or different AutoCAD session with the same program/code loaded.
Yes, saving data to outside data store (file, database...) and later loaded back from there is one of option. The data to be saved would be the Handles of selected entities.
You can also consider save them in a custom NamedDictionary. Or you can attach Xdata to the entities. If you use AutoCAD Map/Civil, you can also have options to use ObjectData/Object Classification (well, it might be a bit overkill to use them just for remembering selected entities, but hey, it is doable technically). All of these does not need external data persistence.
Thank you Jeff and Norman.
I will look into the groups option and the NamedDictionary option and see what may work best in my situation. I will get back to this project this afternoon so will post back on my results.
Yes, I want multiple people to be able to run the same code from different machines and access the same saved entitiy selections.
From my testing, it appears that getting the handle of the selected objects and storing those would be best for my use in this particular case. The only item I may have troubles with is selecting the actual objects when knowing the handles of the objects.
I have found examples of converting the handle to an object id for use within other parts of my code so although I have not implemented that yet, I think it should be relatively straight forward.
Thank you to all of you for your assistance so far. It is greatly appreciated.
I have been doing further research and although I still think an external file to save the handles of the selected objects is the way I will go. I understand I could create a dictionary and store the data, but I havent a clue where to start and where to go. So unless anyone has further ideas on this...