IGH_DocumentObject
Base interface for objects that want to play on the Canvas. Do not implement this interface from scratch. Either inherit from GH_DocumentObject or one of the other partially finished types such as GH_ActiveObject, GH_Param(Of T) or GH_Component.
Namespace: Grasshopper.Kernel
Assembly: Grasshopper (in Grasshopper.dll)
Syntax
public interface IGH_DocumentObject : IGH_InstanceDescription
The IGH_DocumentObject type exposes the following members.
Properties
Name
Description
Public Property
Attributes
Gets or sets the attributes that are associated with this object. Only set custom attributes if you know what you are doing.
Public Property
Category
Gets or sets the Category in which this object belongs. If HasCategory() returns false, this field has no meaning.
(Inherited from IGH_InstanceDescription.)
Public Property
ComponentGuid
Returns a consistent ID for this object type. Every object must supply a unique and unchanging ID that is used to identify objects of the same type.
Public Property
Description
Gets or sets the description of the object. This field typically remains fixed during the lifetime of an object.
(Inherited from IGH_InstanceDescription.)
Public Property
Exposure
Gets the exposure of this object in the Graphical User Interface.
Public Property
HasCategory
Gets whether or not the Category field has been set.
(Inherited from IGH_InstanceDescription.)
Public Property
HasSubCategory
Gets whether or not the SubCategory field has been set.
(Inherited from IGH_InstanceDescription.)
Public Property
Icon_24x24
The icon associated with this object.
Public Property
Icon_24x24_Locked
The greyscale icon of this object.
Public Property
IconDisplayMode
Gets the current display mode of the object.
Public Property
InstanceDescription
Gets a description of the current state of the object. This field is usually the same as the Description() field, but it might be variable when overridden.
(Inherited from IGH_InstanceDescription.)
Public Property
InstanceGuid
Gets the ID of this runtime instance.
(Inherited from IGH_InstanceDescription.)
Public Property
Keywords
Gets a list of additional keywords that describe the object. Typically this list is empty but you can override this property to aid in object searches.
(Inherited from IGH_InstanceDescription.)
Public Property
Name
Gets or sets the name of the object. This field typically remains fixed during the lifetime of an object.
(Inherited from IGH_InstanceDescription.)
Public Property
NickName
Gets or sets the nickname of the object. This field can be changed by the user.
(Inherited from IGH_InstanceDescription.)
Public Property
Obsolete
Gets whether this object is Obsolete.
Public Property
SubCategory
Gets or sets the SubCategory in which this object belongs. If HasSubCategory() returns false, this field has no meaning.
(Inherited from IGH_InstanceDescription.)
Methods
Name
Description
Public Method
AddedToDocument
This method will be called when an object is added to a document.
Public Method
AppendMenuItems
This function is called when a context menu is about to be displayed. Override it to set custom items.
Public Method
CreateAttributes
Create new default attributes for this object. You should only call this function when the Attributes() field is null.
Public Method
DocumentContextChanged
This method will be called when the document that owns this object moves into a different context.
Public Method
ExpirePreview
Call this function when you suspect that the preview has expired for this object. This will cause the display cache to be eradicated.
Public Method
ExpireSolution
Call this function whenever you do something which expires the current solution. This will make sure all caches are erased, all downstream objects are expired and that the event is raised. The default implementation merely places a call to OnSolutionExpired(), override this function in derived classes to make sure you clear local data caches and expire downstream objects.
Public Method
IsolateObject
Destroy all connections to other objects.
Public Method
MovedBetweenDocuments
This method will be called when an object is moved from one document to another.
Public Method
NewInstanceGuid.
Generate a new random instance GUID
(Inherited from IGH_InstanceDescription.)
Public Method
NewInstanceGuid(Guid)
Set the instance ID to be a specific GUID. This is very dangerous, only use this function if you’re 6”4’ and called David.
(Inherited from IGH_InstanceDescription.)
Public Method
OnAttributesChanged
Raises the AttributesChanged event on the toplevel object.
Public Method
OnDisplayExpired
Raises the DisplayExpired event on the toplevel object.
Public Method
OnObjectChanged(GH_ObjectChangedEventArgs)
Raises the ObjectChanged event on the current (!not the top level!) object.
Public Method
OnObjectChanged(GH_ObjectEventType)
Raises the ObjectChanged event on the current (!not the top level!) object.
Public Method
OnObjectChanged(String)
Raises the ObjectChanged event on the current (!not the top level!) object.
Public Method
OnObjectChanged(GH_ObjectEventType, Object)
Raises the ObjectChanged event on the current (!not the top level!) object.
Public Method
OnObjectChanged(String, Object)
Raises the ObjectChanged event on the current (!not the top level!) object.
Public Method
OnPingDocument
Raise the PingDocument Event on the toplevel object and try to find the document which owns this object.
Public Method
OnPreviewExpired
Raises the PreviewExpired event on the toplevel object.
Public Method
OnSolutionExpired
Raises the SolutionExpired event on the toplevel object.
Public Method
RecordUndoEvent(GH_UndoRecord)
Record an entire undo record.
Public Method
RecordUndoEvent(String)
Record a generic object change undo event.
Public Method
RecordUndoEvent(String, IGH_UndoAction)
Record a specific object change undo event.
Public Method
RemovedFromDocument
This method will be called when an object is removed from a document.
Public Method
TriggerAutoSave.
Triggers the AutoSave function on the owner document with the object_changed flag.
Public Method
TriggerAutoSave(GH_AutoSaveTrigger)
Triggers the AutoSave function on the owner document with a custom flag.
Public Method
TriggerAutoSave(Guid)
Triggers the AutoSave function on the owner document with the object_changed flag.
Public Method
TriggerAutoSave(GH_AutoSaveTrigger, Guid)
Triggers the AutoSave function on the owner document with a custom flag.
Events
Name
Description
Public Event
AttributesChanged
Raised whenever the number or kind of attributes changes. This event is handled by GH_Documents who subsequently wipe their attribute caches.
Public Event
DisplayExpired
Raised whenever the display (on the Canvas) of a certain object becomes invalid.
Public Event
ObjectChanged
Raised whenever some property of the object changes that would affect remote instances.
Public Event
PingDocument
Raised whenever an object needs to know which GH_Document it belongs to.
Public Event
PreviewExpired
Raised whenever the display (in the Rhino viewports) of a certain object becomes invalid.
Public Event
SolutionExpired
Raised whenever the solution of a certain object becomes invalid.