When I am deleting a layer I am getting an event of type Rhino.DocObjects.Tables.LayerTableEventType.Deleted
In the arguments I can see the parent layer of the deleted one as NewState and null for the OldState.
Is there any way to receive the actual deleted layer in the arguments? Maybe some other event?
I would like to avoid searching in the child layers of the NewState layer the missing one from my data structure, so I delete it from there as well.
The issue is that I want to get the actual deleted layer in the event info. I cannot.
When I check the layer table I cannot even find child layers of the parent of the deleted one.
“layer1 has layer11 and layer12. I delete layer12 I get layer1 in the deleted event information. When I check the layer1 children layer11 is not there either”. This looks like a bug.
Because the name used by a deleted component, such as layers, is legitimate as a name for a new active component, and no two components can have the same name, deleted components loose their name.
In the Visual Studio debugger, look at e.NewState. Notice now the Index and Id properties are correct? Also notice how the Name property is null?
What is missing from the Layer class is a way of retrieving the name of the layer if the layer is deleted. I’ve added a new DeletedName property for Rhino 6 SR2 that should help with this.