GH_UserObject
Represents a custom user object. A User Object is an existing IGH_DocumentObject with overridden icon, instance description and exposure.
Constructors
Properties
BaseGuid
#Gets or sets the ComponentID of the IGH_DocumentObject that functions as the base class for this User Object.
Data
#Gets or sets the serialized data. This data is used to deserialize a new instance of the base class.
Guid
#Gets or sets the Guid of this User Object. The Guid is created anew during construction and is not stored in the User Object File. You should never have to set this field.
Icon
#public Bitmap Icon { get; set; }
Gets or sets the icon associated with this User Object. If the icon hasn't been overridden, then a Default icon is returned.
Methods
CreateDefaultPath
#Set the Path field for this user object to the default. The default file name is derived from the Description.Name field. This method also ensures the UserObject directory exists.
Parameters:
| avoid_conflict (bool) | If true, a unique file path is assigned. |
InstantiateObject
#Instantiate a new IGH_DocumentObject from this User Object.
Returns: The IGH_DocumentObject instance defined inside the UserObject file or null on error.
ReadFromFile
#public void ReadFromFile()
Force an update of the local data from the file. The Path field must be set for this to work.
Exceptions:
| InvalidOperationException | Thrown when the source file doesn't exist or is corrupted. |
SaveToFile
#Save the current User Object state to a file. Any existing file will be overwritten.
Returns: True on success, false on failure.
SetDataFromObject
#Set the Data field content of ths UserObject from a Document object instance.
Parameters:
| obj (IGH_DocumentObject) | Object to assign |