Is there a way to store various datas in invisible entities?

Hi all,

I’m using RhinoCommon dll with C#.
My program creates many datas which are not intended for being displayed. I’d like to store those datas when a document in Rhino is saved.

I know that in AutoCAD, there is XDATA properties for all objects that allows to store various datas. Besides, invisible point objects also exist, so it’s quite easy to store any property in a DWG file (which is the extension of AutoCAD files).

Is there a similar way to store various datas in a 3dm file ?

Thank you in advance for your answers !

I found something which seems to be similar to XDATA with ObjectAttributes class and UserDatas attribute.

You have a choice:

if the data is bound to a geometry item, you can store it in one of three ways:

  1. UserStrings
  2. UserDictionary http://4.rhino3d.com/5/rhinocommon/html/P_Rhino_Runtime_CommonObject_UserDictionary.htm

3… UserData http://4.rhino3d.com/5/rhinocommon/html/P_Rhino_Runtime_CommonObject_UserData.htm

The first can only store string info. The second can store many simple data types (int, double, bool, Guid, arrays of these, etc.). The third is to store any class structure you want, but you have to provide serialization/deserialization in the class (possibly by just decorating it with [Serializable]).

If you have non-geometry data, you can also write plug-in data to the 3dm file and read it when the 3dm file is opened.

See
http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_PlugIns_PlugIn_ShouldCallWriteDocument.htm
http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_PlugIns_PlugIn_WriteDocument.htm
http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_PlugIns_PlugIn_ReadDocument.htm

Thank you for you explanations, it works fine!