Store Array of Objects in another Objects UserDictionary

I am working on a Python project using rhinocommon and have stumbled on some questions. Is it possible to store an array of geometryBase objects such as curves in the UserDictionary of another object? I see that one option is Set(String, IEnumerable<Guid>) which I have tried doing. Originally I tried simply:

branch[i][0].UserDictionary.Set("Stored",curves)

Which gave me an error “Multiple targets could match: Set(str, IEnumerable[ObjRef]), Set(str, bool), Set(str, IEnumerable[Guid]), …”. So I tried the following:

branch[i][0].UserDictionary.Set.Overloads[str,IEnumerable[Guid]]("Stored",curves)

However now I am receiving an error “MakeGenericType on non-generic type”. And even if I get this to work I would prefer if these curves lived only in the memory and not as a manipulable object in the document.

TL:DR: How can I store a list of curves in another objects UserDictionary? If not possible, how do I at least store a list of Guids in another objects UserDictionary?

EDIT: Solved the user dictionary of Guid (was importing System.Collections.IEnumerable as IEnumerable instead of System.Collections.Generic.IEnumerable as IEnumerable (used in “.Overloads[…”). This is fine, and I am just locking and hiding the curve objects before adding their Guids to the dictionary, however hideSwap causes them to appear still, and I am looking for these objects to not be possible to interact with in any way so this is still not ideal. However found another post about converting to byte array and and then storing strings that way, is that possible for curve objects potentially as well?

1 Like

Another update, turns out this appears to be possible. For those curious using the cPickle.dumps() and loads() functions, and then storing it in a byte array in the user dictionary. I am pretty happy with this solution for now, though it may have limitations that I was not aware of, I will update any findings in this forum.