@menno wrote:
When I create a layer, set an entry on its user dictionary and change a property (in this case
IsVisible
) everything is fine. However, if I add the layer, the get it from the layer collection and then changeIsVisible
, the user dictionary gets cleared.@dale can you confirm this? I am still on SR10, so it may have been fixed in the mean time.
public Result RunCommand(RhinoDoc doc, RunMode mode) { Layer l = new Layer(); l.Name = "With User Dictionary Entry"; //int idx = doc.Layers.Add(l); //Layer retrieved = doc.Layers[idx]; l.UserDictionary.SetEnumValue(mode); RhinoApp.WriteLine($"User dictionary has {l.UserDictionary.Count} entries"); l.IsVisible = false; RhinoApp.WriteLine($"User dictionary has {l.UserDictionary.Count} entries"); l.IsVisible = true; int idx = doc.Layers.Add(l); Layer retrieved = doc.Layers[idx]; RhinoApp.WriteLine($"Retrieved user dictionary has {retrieved.UserDictionary.Count} entries"); retrieved.IsVisible = false; // now, in the layer that was obtained from the layers collection, settings IsVisible=false // will clear out the user dictionary. This is unexpected behavior. RhinoApp.WriteLine($"Retrieved user dictionary has {retrieved.UserDictionary.Count} entries"); retrieved.IsVisible = true; RhinoApp.WriteLine($"Retrieved user dictionary has {retrieved.UserDictionary.Count} entries"); return Result.Success; }
Posts: 1
Participants: 1