Standard implementation of IGH_DocumentObject.

Constructors

GH_DocumentObject

#
protected GH_DocumentObject(IGH_InstanceDescription tag)
tag (IGH_InstanceDescription)

GH_DocumentObject

#
protected GH_DocumentObject(string name, string nickName, string description, string category, string subCategory)
name (string)
nickName (string)
description (string)
category (string)
subCategory (string)

GH_DocumentObject

#
[EditorBrowsable(EditorBrowsableState.Never)] protected GH_DocumentObject(string name, string nickname, string description, string category)
name (string)
nickname (string)
description (string)
category (string)

Fields

m_attributes

#
protected IGH_Attributes m_attributes

Properties

Attributes

#
public 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.
Attributes

Category

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

ComponentGuid

#
public abstract 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.
ComponentGuid

Description

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

Exposure

#
public virtual GH_Exposure Exposure { get; }
Gets the exposure of this object in the Graphical User Interface. The default is to expose everywhere.
Exposure

HasCategory

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

HasSubCategory

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

Icon

#
protected virtual Bitmap Icon { get; }
Override this function to supply a custom icon (24x24 pixels). The result of this property is cached, so don't worry if icon retrieval is not very fast.

Icon_24x24

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

Icon_24x24_Locked

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

IconDisplayMode

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

InstanceDescription

public virtual 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 fromGH_InstanceDescription

InstanceGuid

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

Internal_Icon_24x24

#
[EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] protected virtual Bitmap Internal_Icon_24x24 { get; }
Override this function to supply a custom icon. The result of this property is cached, so don't worry if icon retrieval is not very fast.

Keywords

public virtual 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 fromGH_InstanceDescription
Keywords

Name

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

NickName

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

Obsolete

#
public virtual bool Obsolete { get; }
Gets whether this object is obsolete. Default implementation returns true if the class name contains the string "OBSOLETE" or if this class has been decorated with the ObsoleteAttribute. You are free to override this if you want, but I suggest adding the ObsoleteAttribute instead.
Obsolete

SubCategory

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

Methods

AddedToDocument

#
public virtual void AddedToDocument(GH_Document document)
This method will be called when an object is added to a document. Override this method if you want to handle such events.
document (GH_Document)Document that now owns this object.
AddedToDocument

AppendMenuItems

#
public virtual 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.
If true, the menu will be displayed, if false the menu will be supressed.
AppendMenuItems

ConnectNewObject

#
protected internal static bool ConnectNewObject(IGH_Param source, IGH_DocumentObject target, GH_ParamKind side)
source (IGH_Param)
target (IGH_DocumentObject)
side (GH_ParamKind)

CopyFrom

public void CopyFrom(IGH_InstanceDescription other)
Copy all fields (except the instance ID) from another instance description.
inherited fromGH_InstanceDescription
other (IGH_InstanceDescription)Object to mimic.

CreateAttributes

#
public abstract void CreateAttributes()
This function creates the stand-alone attributes for this object. If you wish to supply your own Attributes, you must override this function.
CreateAttributes

DestroyIconCache

#
protected void DestroyIconCache()
Call this method to erase the existing icon cache. You must call this if you want to change the display icon of an object.

DocumentContextChanged

#
public virtual 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

#
public virtual 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)
ExpirePreview

ExpireSolution

#
public virtual 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.
ExpireSolution

GetValue

#
protected bool GetValue(string valueName, bool default)
Get a boolean value from the component value table.
valueName (string)Name of boolean to retrieve.
default (bool)Default value to return in case of missing named value.
The boolean value with the given name of the default value.

GetValue

#
protected Color GetValue(string valueName, Color default)
Get a color value from the component value table.
valueName (string)Name of color to retrieve.
default (Color)Default value to return in case of missing named value.
The color value with the given name of the default value.

GetValue

#
protected double GetValue(string valueName, double default)
Get a double value from the component value table.
valueName (string)Name of double to retrieve.
default (double)Default value to return in case of missing named value.
The double value with the given name of the default value.

GetValue

#
protected int GetValue(string valueName, int default)
Get an integer value from the component value table.
valueName (string)Name of integer to retrieve.
default (int)Default value to return in case of missing named value.
The integer value with the given name of the default value.

GetValue

#
protected string GetValue(string valueName, string default)
Get a string value from the component value table.
valueName (string)Name of string to retrieve.
default (string)Default value to return in case of missing named value.
The string value with the given name of the default value.

HtmlHelp_Source

#
protected internal virtual string HtmlHelp_Source()
Return a String which contains HTML formatted source for the help topic. If you want to pass a URL that points to a remote page, then prefix the URL with a GOTO: tag, like so: GOTO:http://www.YourWebAddressHere.com
Remarks: You can use the GUI.GH_HtmlFormatter class to generate an HTML page which conforms to Grasshopper Help standards

IsolateObject

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

MovedBetweenDocuments

#
public virtual void MovedBetweenDocuments(GH_Document oldDocument, GH_Document newDocument)
This method will be called when an object is moved from one document to another. Override this method if you want to handle such events.
oldDocument (GH_Document)Document that used to own this object.
newDocument (GH_Document)Document that now owns ths object.

NewInstanceGuid

public void NewInstanceGuid()
Generate a new random instance GUID
inherited fromGH_InstanceDescription
NewInstanceGuid

NewInstanceGuid

public 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 your first name is David.
inherited fromGH_InstanceDescription
UUID (Guid)
NewInstanceGuid

OnAttributesChanged

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

OnDisplayExpired

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

OnObjectChanged

#
public void OnObjectChanged(GH_ObjectChangedEventArgs e)
OnObjectChanged

OnObjectChanged

#
public void OnObjectChanged(GH_ObjectEventType eventType, object tag)
eventType (GH_ObjectEventType)
tag (object)
OnObjectChanged

OnObjectChanged

#
public void OnObjectChanged(GH_ObjectEventType eventType)
eventType (GH_ObjectEventType)
OnObjectChanged

OnObjectChanged

#
public void OnObjectChanged(string customEvent, object tag)
customEvent (string)
tag (object)
OnObjectChanged

OnObjectChanged

#
public void OnObjectChanged(string customEvent)
customEvent (string)
OnObjectChanged

OnPingDocument

#
public 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.
OnPingDocument

OnPreviewExpired

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

OnSolutionExpired

#
public void OnSolutionExpired(bool recompute)
Raises the SolutionExpired event on the toplevel object. You probably want to call ExpireSolution() instead of this method directly.
recompute (bool)If True, the solution will be immediately recalculated.
OnSolutionExpired

Read

#
public override bool Read(GH_IReader reader)
reader (GH_IReader)

ReadFull

public virtual bool ReadFull(GH_IReader reader)
GH_InstanceDescription does not by default serialize all fields. Use this function to read all fields from the archive. This method is compatible with the default Write()/Read() operations.
inherited fromGH_InstanceDescription
reader (GH_IReader)Writer for deserialization.
True on success, false on failure.

RecordUndoEvent

#
public 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.
The ID of the newly added record or Guid.Empty on failure.
RecordUndoEvent

RecordUndoEvent

#
public Guid RecordUndoEvent(string undoName)
Record a generic object change undo event.
undoName (string)Name of undo record.
The ID of the newly added record or Guid.Empty on failure.
RecordUndoEvent

RecordUndoEvent

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

RemovedFromDocument

#
public virtual void RemovedFromDocument(GH_Document document)
This method will be called when an object is removed from a document. Override this method if you want to handle such events.
document (GH_Document)Document that now no longer owns this object.

SetIconOverride

#
public void SetIconOverride(Bitmap customIcon)
Set a new custom icon override for this object.
customIcon (Bitmap)Icon override. Should be a 24x24 image.

SetValue

#
protected void SetValue(string valueName, bool value)
Set a named value. This value will be serialized with the component.
valueName (string)Name of value.
value (bool)Value itself.

SetValue

#
protected void SetValue(string valueName, Color value)
Set a named value. This value will be serialized with the component.
valueName (string)Name of value.
value (Color)Value itself.

SetValue

#
protected void SetValue(string valueName, double value)
Set a named value. This value will be serialized with the component.
valueName (string)Name of value.
value (double)Value itself.

SetValue

#
protected void SetValue(string valueName, int value)
Set a named value. This value will be serialized with the component.
valueName (string)Name of value.
value (int)Value itself.

SetValue

#
protected void SetValue(string valueName, string value)
Set a named value. This value will be serialized with the component.
valueName (string)Name of value.
value (string)Value itself.

TriggerAutoSave

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

TriggerAutoSave

#
public 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

TriggerAutoSave

#
public 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

TriggerAutoSave

#
public 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.
TriggerAutoSave

ValuesChanged

#
protected virtual void ValuesChanged()
Override this method if you want to respond to changes to the value table. The base implementation is empty, so you don't have to call it.

Write

#
public override bool Write(GH_IWriter writer)
writer (GH_IWriter)

WriteFull

public virtual bool WriteFull(GH_IWriter writer)
GH_InstanceDescription does not by default serialize all fields. Use this function to write all fields to the archive. This method is compatible with the default Write()/Read() operations.
inherited fromGH_InstanceDescription
writer (GH_IWriter)Writer for serialization.
True on success, false on failure.

Events

AttributesChanged

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

DisplayExpired

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

ObjectChanged

#
ObjectChanged

PingDocument

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

PreviewExpired

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

SolutionExpired

#
public event IGH_DocumentObject.SolutionExpiredEventHandler SolutionExpired
Raised whenever the solution of a certain object becomes invalid.
SolutionExpired