IGH_DocumentObject

References
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.

Properties

Attributes

#
IGH_Attributes Attributes { get; set; }
Gets or sets the attributes that are associated with this object. Only set custom attributes if you know what you are doing.

Category

string Category { get; set; }
Gets or sets the Category in which this object belongs. If HasCategory() returns false, this field has no meaning.
inherited fromIGH_InstanceDescription

ComponentGuid

#
Guid ComponentGuid { get; }
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.

Description

string Description { get; set; }
Gets or sets the description of the object. This field typically remains fixed during the lifetime of an object.
inherited fromIGH_InstanceDescription

Exposure

#
GH_Exposure Exposure { get; }
Gets the exposure of this object in the Graphical User Interface.

HasCategory

bool HasCategory { get; }
Gets whether or not the Category field has been set.
inherited fromIGH_InstanceDescription

HasSubCategory

bool HasSubCategory { get; }
Gets whether or not the SubCategory field has been set.
inherited fromIGH_InstanceDescription

Icon_24x24

#
Bitmap Icon_24x24 { get; }
The icon associated with this object.

Icon_24x24_Locked

#
Bitmap Icon_24x24_Locked { get; }
The greyscale icon of this object.

IconDisplayMode

#
GH_IconDisplayMode IconDisplayMode { get; set; }
Gets the current display mode of the object.

InstanceDescription

string InstanceDescription { get; }
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 fromIGH_InstanceDescription

InstanceGuid

Guid InstanceGuid { get; }
Gets the ID of this runtime instance.
inherited fromIGH_InstanceDescription

Keywords

IEnumerable<string> Keywords { get; }
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 fromIGH_InstanceDescription

Name

string Name { get; set; }
Gets or sets the name of the object. This field typically remains fixed during the lifetime of an object.
inherited fromIGH_InstanceDescription

NickName

string NickName { get; set; }
Gets or sets the nickname of the object. This field can be changed by the user.
inherited fromIGH_InstanceDescription

Obsolete

#
bool Obsolete { get; }
Gets whether this object is Obsolete.

SubCategory

string SubCategory { get; set; }
Gets or sets the SubCategory in which this object belongs. If HasSubCategory() returns false, this field has no meaning.
inherited fromIGH_InstanceDescription

Methods

AddedToDocument

#
void AddedToDocument(GH_Document document)
This method will be called when an object is added to a document.
document (GH_Document)Document that now owns this object.

AppendMenuItems

#
bool AppendMenuItems(ToolStripDropDown menu)
This function is called when a context menu is about to be displayed. Override it to set custom items.
menu (ToolStripDropDown)Menu object to populate.

CreateAttributes

#
void CreateAttributes()
Create new default attributes for this object. You should only call this function when the Attributes() field is null.

DocumentContextChanged

#
void DocumentContextChanged(GH_Document document, GH_DocumentContext context)
This method will be called when the document that owns this object moves into a different context.
document (GH_Document)Document that owns this object.
context (GH_DocumentContext)The reason for this event.

ExpirePreview

#
void ExpirePreview(bool redraw)
Call this function when you suspect that the preview has expired for this object. This will cause the display cache to be eradicated.
redraw (bool)

ExpireSolution

#
void ExpireSolution(bool recompute)
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.
recompute (bool)If True, the solution will be recomputed straight away.

IsolateObject

#
void IsolateObject()
Destroy all connections to other objects.

MovedBetweenDocuments

#
void MovedBetweenDocuments(GH_Document oldDocument, GH_Document newDocument)
This method will be called when an object is moved from one document to another.
oldDocument (GH_Document)Document that used to own this object.
newDocument (GH_Document)Document that now owns ths object.

NewInstanceGuid

void NewInstanceGuid()
Generate a new random instance GUID
inherited fromIGH_InstanceDescription

NewInstanceGuid

void NewInstanceGuid(Guid UUID)
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 fromIGH_InstanceDescription
UUID (Guid)

OnAttributesChanged

#
void OnAttributesChanged()
Raises the AttributesChanged event on the toplevel object.

OnDisplayExpired

#
void OnDisplayExpired(bool redraw)
Raises the DisplayExpired event on the toplevel object.
redraw (bool)If True, the canvas will be immediately redrawn.

OnObjectChanged

#
void OnObjectChanged(GH_ObjectChangedEventArgs e)
Raises the ObjectChanged event on the current (!not the top level!) object.
e (GH_ObjectChangedEventArgs)Fully constructed event arguments.

OnObjectChanged

#
void OnObjectChanged(GH_ObjectEventType eventType, object tag)
Raises the ObjectChanged event on the current (!not the top level!) object.
eventType (GH_ObjectEventType)Type of change.
tag (object)Tag to apply to the event arguments.

OnObjectChanged

#
void OnObjectChanged(GH_ObjectEventType eventType)
Raises the ObjectChanged event on the current (!not the top level!) object.
eventType (GH_ObjectEventType)Type of change.

OnObjectChanged

#
void OnObjectChanged(string customEvent, object tag)
Raises the ObjectChanged event on the current (!not the top level!) object.
customEvent (string)Custom change type name.
tag (object)Tag to apply to the event arguments.

OnObjectChanged

#
void OnObjectChanged(string customEvent)
Raises the ObjectChanged event on the current (!not the top level!) object.
customEvent (string)Custom change type name.

OnPingDocument

#
GH_Document OnPingDocument()
Raise the PingDocument Event on the toplevel object and try to find the document which owns this object.
The document which owns this object if successful, or nothing if no document owns this object.

OnPreviewExpired

#
void OnPreviewExpired(bool redraw)
Raises the PreviewExpired event on the toplevel object.
redraw (bool)If True, the viewports will be immediately redrawn.

OnSolutionExpired

#
void OnSolutionExpired(bool recompute)
Raises the SolutionExpired event on the toplevel object.
recompute (bool)If True, the solution will be immediately recalculated.

Read

bool Read(GH_IReader reader)
This method is called whenever the instance is required to deserialize itself.
inherited fromGH_ISerializable
reader (GH_IReader)Reader object to deserialize from.
True on success, false on failure.

RecordUndoEvent

#
Guid RecordUndoEvent(string undoName, IGH_UndoAction action)
Record a specific object change undo event.
undoName (string)Name of undo record.
action (IGH_UndoAction)Undo action to record.

RecordUndoEvent

#
Guid RecordUndoEvent(string undoName)
Record a generic object change undo event.
undoName (string)Name of undo record.

RecordUndoEvent

#
void RecordUndoEvent(GH_UndoRecord record)
Record an entire undo record.
record (GH_UndoRecord)Record to push.

RemovedFromDocument

#
void RemovedFromDocument(GH_Document document)
This method will be called when an object is removed from a document.
document (GH_Document)Document that now no longer owns this object.

TriggerAutoSave

#
void TriggerAutoSave()
Triggers the AutoSave function on the owner document with the object_changed flag.

TriggerAutoSave

#
void TriggerAutoSave(GH_AutoSaveTrigger trigger, Guid id)
Triggers the AutoSave function on the owner document with a custom flag.
trigger (GH_AutoSaveTrigger)Reason for the autosave operation. It is possible that a user has decided to avoid autosave events for specific types, so if you can, try and provide a correct trigger flag.
id (Guid)ID of autosave event. Consecutive autosave requests with the same ID will be ignored.

TriggerAutoSave

#
void TriggerAutoSave(GH_AutoSaveTrigger trigger)
Triggers the AutoSave function on the owner document with a custom flag.
trigger (GH_AutoSaveTrigger)Reason for the autosave operation. It is possible that a user has decided to avoid autosave events for specific types, so if you can, try and provide a correct trigger flag.

TriggerAutoSave

#
void TriggerAutoSave(Guid id)
Triggers the AutoSave function on the owner document with the object_changed flag.
id (Guid)ID of autosave event. Consecutive autosave requests with the same ID will be ignored.

Write

bool Write(GH_IWriter writer)
This method is called whenever the instance is required to serialize itself.
inherited fromGH_ISerializable
writer (GH_IWriter)Writer object to serialize with.
True on success, false on failure.

Events

AttributesChanged

#
Raised whenever the number or kind of attributes changes. This event is handled by GH_Documents who subsequently wipe their attribute caches.

DisplayExpired

#
Raised whenever the display (on the Canvas) of a certain object becomes invalid.

ObjectChanged

#
Raised whenever some property of the object changes that would affect remote instances.

PingDocument

#
Raised whenever an object needs to know which GH_Document it belongs to.

PreviewExpired

#
Raised whenever the display (in the Rhino viewports) of a certain object becomes invalid.

SolutionExpired

#
Raised whenever the solution of a certain object becomes invalid.