Get Elefront Attributes fom C# sdk Plugin

Here is a sample of code that we use to serialize our data objects onto rhino geometry, a rhino object named rhinoObject saved like this:

var objectToSerialize = new SerializeThisObject();
string key = "dataKey";
string val = JsonConvert.SerializeObject(objectToSerialize, Formatting.None);
rhinoObject.Attributes.UserDictionary.Set(key, val);

You can then simply check the rhinoObject for the key to see if the data is there:

if(rhinoObject.Attributes.UserDictionary.ContainsKey(key))
{
    rhinoObject.Attributes.TryGetString(key, out string serializedDataObject);
    // Deserialize Your Object
    // ...
}

I don’t think you need to mess with the ArchivableDictionary unless you are overidding the WriteDocument logic to embed data into the file.

image