Why is it that UserDictionary doesn't work with Points

I use a geometry’s UserDictionary to store some additional information (in GH). This works well for all kinds of geometry, except for Points. Although it is possible to add an item in a Point’s UserDictionary, if the point is passed from one python Component to another, the values stored in the UserDictionary are lost. If the Point is referenced as the geometry in an AttributedGeometry when updating the UserDictionary, the update cannot be found (KeyNotFound error), as if the Point geometry in the AttributedGeometry has been replaced with a copy of the Point omitting the UserDictionary.

I was wondering what the explanation is for this entirely different behavior of Points when compared to other geometries.

It also won’t work for arcs, lines, circles, rectangles, boxes, …

User dictionaries can only be attached to data which derives from GeometryBase (or possibly CommonObject). Point3d, Arc, Circle, etc are structs.

There are GeometryBase versions of these types called Point, ArcCurve, LineCurve etc. but they are not used to store those values in grasshopper. Those advanced types are automatically converted into the simpler types when you assign them to a parameter.

1 Like

Dear David,
Thanks for the clarification. It is good to know. I will work around this.