How to remove an object from the properties manager programmatically?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have a number of custom objects which have other custom objects as embedded members, using AcDbObjectIds. The objects have COM wrappers for the property manager, and the sub-objects can often have wrappers as well. Thus, when you use a crossing window to select entities, both end up selected for display.
When you have objects of multiple types selected, you can select a subset by choosing the type from the drop-down list, and properties common to that subset are then displayed.
The problem I have is that when selecting one of the parent objects in this manner (while sub-objects are also selected) and changing a property that causes some or all of those sub-objects to become erased, trying to deselect everything when the property change is complete results in a fatal crash under 2012. If the sub-objects that get erased were not selected at the time, this wouldn't be a problem, but we can't exactly tell users "pick the parent objects one by one" as that simply isn't practical (and they shouldn't have to).
Although I can get a hold of the property manager object, it doesn't appear to have any way of finding out what is currently selected for display (including what subset is selected from the drop-down list), or to manipulate those items in any way.
Does anyone know how to / if it's possible to programmatically remove an object from the property manager's list so that we can remove erased objects and prevent the crash? Removing the underlying custom object from the selection set is not enough - in fact it's automatic when the object is erased. It's the COM wrapper object created to support the property manager that needs to be cleanly removed and destroyed.
Hope that made sense.