UserDictionary not serialized for brepEdge?

Hi,

In my plugin, I add a bool to selected brepFaces or brepEdges, then display it with a custom conduit.
That works, and both are displayed correctly.
However when I save the file and reopen it again, only the UserDictionary on the brepFaces are correctly restored. The brepEdges UserDictionary doesn’t load the bool.

Rhino 6 Mac

This is my code for assigning:

BrepFace face = ...
face.UnderlyingSurface().UserDictionary.Set("key_face", true);
BrepFace face = ...
edge.UserDictionary.Set(Constants.USER_KEY_EDGE_BEVEL, true);

Any tips?

Best,
Aske

Hi @aske,

A topolgical BrepEdge is a curve proxy, which is just a reference to another curve, perhaps even a subdomain of the referenced curve. Because of this, a BrepEdge doesn’t have any real geometry of its own for which to serialize user data on. So, the behavior you describe is expected.

Just as you do when assigning user data to a BrepFace (notice how you attached to the faces underlying surface) you need to find some real geometry to attach the data to, perhaps the curve returned by BrepEdge.EdgeCurve.

– Dale

1 Like

I was confused by the terminology: I thought edgecurve was somehow an abstraction on top of the edge, instead of the opposite.

Perfect! Thanks Dale!

Btw. someone might want to fix the docs here Rhino - Plugin User Data :

In fact object user data can be attached to any class derived from CommonObject. This user data is stored in a linked list on CommonObject and can be copied, transformed and saved along with the parent object.
[…]
It is recommended to typically use the User Strings or the UserDictionary on an object since the data is automatically serialized for you and it is easily shared between plugins and scripts.

because that’s obviously not true based on @dale s explanation.