When making a C# plugin for Rhino, our Command subscribes to RhinoDoc.LayerTableEvent to react when a user moves a layer from a certain place into another. To accomplish this, we need to read the OldState and the NewState’s FullPaths to determine the previous and target Parentage of the moved Layer. Unfortunately, OldState appears to represent a parent-less state: FullPath is just Name, and ParentId = guid.Empty. This makes it impossible to know the true original position in the Layer hierarchy.
In the sample scenario screenshotted below, I’m moving a layer from under ParentLayer2 to under ParentLayer1.
Variations of this issue have been noted in 2017 and 2019, but with different scripting goals that were able to be worked around, and no true explanations or solutions were provided. As you can see from the script’s intended functionality above, there is no clean workaround in this case, so I wanted to resurrect the issue to understand if this is intentional behavior on Rhino’s part, or if this can be considered a bug that should be addressed.
Thanks so much!