How to keep UserDictionary on DuplicateSegments

Hi all,

is there a way to manipulate objects and keep UserDictionary on SubObjects?
I try to get DuplicateSegments while keeping UserDictionary on all Segments.

sc.doc = rh.RhinoDoc.ActiveDoc
t = sc.doc.Objects.FindId(x)
t.UserDictionary.Set("T",5)
t = rh.Geometry.Curve.DuplicateSegments(t.Geometry)
print t[0].UserDictionary.TryGetValue("T")   

Capture

Maybe its not the best idea to keep UserDictionary on Objects that get manipulated.

Any help is welcome

Hi,
You could explicitly set the userdict of the resulting objects to match the parent userdict. You could even define a helper function which takes as arguments the function to be called and the parameters and sets the userdict of the returned objects before returning the object, if you will be doing this a lot…