Save Error using UserDictionary "Failed to write 3dm file instance definition table"

I am writing a python plugin that writes data to the UserDictionary (as in previous topic) for different curve objects, and am hoping this data gets saved along with the document. However, I am receiving this error upon saving:

Failed to write 3dm file instance definition table

I am not sure what is causing this error, could this potentially be a bug?

Hi @dks5254,

Can you provide a simple sample that allows us to repeat the problem?

– Dale

import Rhino as r
import rhinoscriptsyntax as rs
import cPickle as cp
import System.Byte as Byte
import System.Collections.Generic.IEnumerable as IEnumerable


obj1Id = rs.GetObject("object A")
obj2Id = rs.GetObjects("objects to store in A")

if obj1Id and obj2Id:
    baseobj = rs.coercerhinoobject(obj1Id)
    
    storedGeometry = []
    for item in obj2Id:
        storedGeometry.append(cp.dumps(rs.coercerhinoobject(obj1Id).Geometry))
    baseobj.Attributes.UserDictionary.Set.Overloads[str,IEnumerable[Byte]]("StoredGeometry",storedGeometry)

@dale Here is a simple script that recreates the error upon saving.

Hi @dks5254,

Does this work any better?

– Dale

@dale using this function still results in the same error upon saving when storing the byte array in the user dictionary of an object (still using “obj.Attributes.UserDictionary.Set.Overloads[str,IEnumerable[Byte]]”)

Hi @dks5254 - I’ve updated the above sample. Check it again and see if it’s what you want.

– Dale

@Dale I got it to work with a bit of modification, thanks!