OnDeleteObject

In a Rhino document I have some objects that are grouped in a group. One of these objects is located in an invisible layer and the object too in not visible. If I delete the parent object all the objects are deleted except the only one that is in the invisible layer. In my plug-in I use the OnDeleteObject (overriding it) for putting the invisible layer in the visible state but it seems not working as I expected because the object that is in the invible layer is not cancelled even though the layer become visible and the object too. It seems that the OnDeleteObject works after the delete command, not before. Any ideas for solving my problem well be very appreciated.

This is correct. Groups are only used for group selection. Group objects are not linked - deleting an object in a group will not cause other grouped objects to be deleted.

The Delete command works on selected objects. Because one of the grouped objects was hidden, it wasn’t selected. Thus, it won’t be deleted.

Hope this helps.

Hi Dale, thank you for your help. So, if I undestand well, in my OnDeleteObject routine after ever made visible the unvisible layer I have also to select, by code, the object in this layer so that the delete command can act on all the objects of the group. Is this correct?
Thank you.

The Delete command only deletes selected objects. Because one of the grouped object was hidden, it was not selectable and not selected. Thus, it was not deleted.

Hope this helps…