The Rhino SDK allows plug-in developers to store custom data inside of Rhino's 3DM file. This data is referred to as user data. There are two types of user data:
Document user data - custom data that is stored at the document level of the 3DM file.
Object user data - custom data that is attached to either an object's geometry or an object's attributes.
Important. When storing custom data on an object, the data can be stored on either the object's geometry (e.g. curve, surfaces, etc), or on the object's attributes. An object's attributes maintain it's layer, color and other non-geometric properties. The difference between the two storage methods is that adding or modifying user data that is located on an object's geometry will cause Rhino to place a copy of the object on the Undo stack. Thus, if you are working with large geometric object or lots of user data, it is more efficient to store object user data on an object's attributes.
RhinoScript supports both document user data and object user data. The RhinoScript user data object organizes custom information similar to that of a Windows-style initialization (INI) file. For example:
[Section1]
Entry1 = String1
Entry2 = String2
...
[Section2]
Entry1 = String1
Entry2 = String2
...
If you find this data structure is too limiting, you might consider creating a plug-in, using the Rhino SDK. Also, RhinoScript's user data object only stores string values for VBScript string can be easily converted from one data type to another.
Rhino now provides a standardized mechanism for users, scripters, and plug-in developers to store and retrieve simple text information on an object and in the document. This mechanism called User Text.
Unlike RhinoScript's User Data methods, which stores data as Section/Entry/String, Rhino stores User Text key/value pairs.
Rhino supports this method of storing object data with its GetUserText, SetUserText, GetDocumentUserText and SetDocumentUserText commands. RhinoScript supports this mechanism with the GetUserText, SetUserText, GetDocumentUserText, and SetDocumentUserText methods.
Method |
Description |
Returns the number of RhinoScript user data items stored on an object's attributes. |
|
Removes RhinoScript user data stored on an object's attributes. |
|
Removes RhinoScript user data stored in the current document. |
|
Removes RhinoScript user data stored on an object's geometry. |
|
Returns the number of RhinoScript user data items stored in the current document. |
|
Returns a RhinoScript user data item stored on an object's attributes. |
|
Returns a RhinoScript user data item stored in the current document. |
|
Returns user text that is stored in the document. |
|
Returns a RhinoScript user data item stored on an object's geometry. |
|
Returns user text that is stored on an object. |
|
Verifies that an object's attributes contains RhinoScript user data. |
|
Verifies that the current document contains RhinoScript user data. |
|
Verifies that the document contains user text. |
|
Verifies that an object's geometry contains RhinoScript user data. |
|
Verifies that an object contains user text. |
|
Returns the number of RhinoScript user data items stored on an object's geometry. |
|
Adds or sets a RhinoScript user data item stored on an object's attributes. |
|
Adds or sets a RhinoScript user data item stored in the current document. |
|
Sets or removes user text stored in the document. |
|
Adds or sets a RhinoScript user data item stored on an object's geometry. |
|
Sets or removes user text stored on an object. |