GH_DocumentObject
Standard implementation of IGH_DocumentObject.
Inheritance Hierarchy
System.Object
Grasshopper.Kernel.GH_InstanceDescription
Grasshopper.Kernel.GH_DocumentObject
Grasshopper.Kernel.GH_ActiveObject
Namespace: Grasshopper.Kernel
Assembly: Grasshopper (in Grasshopper.dll)
Syntax
public abstract class GH_DocumentObject : GH_InstanceDescription, IGH_DocumentObject
The GH_DocumentObject type exposes the following members.
Constructors
Name
Description
Protected method
GH_DocumentObject(IGH_InstanceDescription)
Initializes a new instance of the GH_DocumentObject class
Protected method
GH_DocumentObject(String, String, String, String, String)
Initializes a new instance of the GH_DocumentObject class
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 GH_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 GH_InstanceDescription.)
Public Property
Exposure
Gets the exposure of this object in the Graphical User Interface. The default is to expose everywhere.
Public Property
HasCategory
Gets whether or not the Category field has been set.
(Inherited from GH_InstanceDescription.)
Public Property
HasSubCategory
Gets whether or not the SubCategory field has been set.
(Inherited from GH_InstanceDescription.)
Protected property
Icon
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.
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 GH_InstanceDescription.)
Public Property
InstanceGuid
Gets the ID of this runtime instance.
(Inherited from GH_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 GH_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 GH_InstanceDescription.)
Public Property
NickName
Gets or sets the nickname of the object. This field can be changed by the user.
(Inherited from GH_InstanceDescription.)
Public Property
Obsolete
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.
Public Property
SubCategory
Gets or sets the SubCategory in which this object belongs. If HasSubCategory() returns false, this field has no meaning.
(Inherited from GH_InstanceDescription.)
Methods
Name
Description
Public Method
AddedToDocument
This method will be called when an object is added to a document. Override this method if you want to handle such events.
Public Method
AppendMenuItems
This function is called when a context menu is about to be displayed. Override it to set custom items.
Public Method
CopyFrom
Copy all fields (except the instance ID) from another instance description.
(Inherited from GH_InstanceDescription.)
Public Method
CreateAttributes
This function creates the stand-alone attributes for this object. If you wish to supply your own Attributes, you must override this function.
Protected method
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.
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.
Protected method
GetValue(String, Boolean)
Get a boolean value from the component value table.
Protected method
GetValue(String, Double)
Get a double value from the component value table.
Protected method
GetValue(String, Color)
Get a color value from the component value table.
Protected method
GetValue(String, Int32)
Get an integer value from the component value table.
Protected method
GetValue(String, String)
Get a string value from the component value table.
Protected method
HtmlHelp_SourceReturn 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
Public Method
IsolateObject
Destroy all connections to other objects.
Public Method
Static Member
Menu_AppendColourPicker
Add a colour picker to a menu.
Public Method
Static Member
Menu_AppendCustomItem(ToolStripDropDown, Control)
Utility function for inserting exotic controls into dropdown menus.
Public Method
Static Member
Menu_AppendCustomItem(ToolStripDropDown, Control, KeyDownEventHandler)
Utility function for inserting exotic controls into dropdown menus.
Public Method
Static Member
Menu_AppendCustomItem(ToolStripDropDown, Control, KeyDownEventHandler, Boolean, Int32, Boolean)
Utility function for inserting exotic controls into dropdown menus.
Public Method
Static Member
Menu_AppendDigitScrollerItem
Utility function for inserting a digit scroller into menus.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String)
Utility function for appending generic menu items.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String, EventHandler)
Utility function for appending generic menu items.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String, EventHandler, Boolean)
Utility function for appending generic menu items.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String, EventHandler, Image)
Utility function for appending generic menu items.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String, EventHandler, Boolean, Boolean)
Utility function for appending generic menu items.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String, EventHandler, Image, Object)
Utility function for appending generic menu items.
Public Method
Static Member
Menu_AppendItem(ToolStrip, String, EventHandler, Image, Boolean, Boolean)
Utility function for appending generic menu items.
Protected method
Menu_AppendObjectHelp
Appends the default object Help menu item.
Protected method
Menu_AppendObjectName
Appends the old-fashioned object name menu item. If you also want the Display mode toggle then use Menu_AppendObjectNameEx()
Protected method
Menu_AppendObjectNameEx
Appends the default object name + display mode menu item.
Protected method
Menu_AppendPublish
Appends the default item for publishing to RCP. This menu will only appear if the current class implement IRcpAwareObject
Public Method
Static Member
Menu_AppendSeparator
Utility function for appending separators to a menu dropdown. If the dropdown is empty or if it already has a separator at the bottom, nothing will happen.
Public Method
Static Member
Menu_AppendTextItem(ToolStripDropDown, String, GH_MenuTextBox.KeyDownEventHandler, GH_MenuTextBox.TextChangedEventHandler, Boolean)
Utility function for inserting text boxes into menus.
Public Method
Static Member
Menu_AppendTextItem(ToolStripDropDown, String, GH_MenuTextBox.KeyDownEventHandler, GH_MenuTextBox.TextChangedEventHandler, Boolean, Int32, Boolean)
Utility function for inserting text boxes into menus.
Public Method
Static Member
Menu_MoveItem(ToolStripItem, .String.)
Utility function for moving menu items.
Public Method
Static Member
Menu_MoveItem(ToolStripItem, Boolean, .String.)
Utility function for moving menu items.
Public Method
MovedBetweenDocuments
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.
Public Method
NewInstanceGuid.
Generate a new random instance GUID
(Inherited from GH_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 your first name is David.
(Inherited from GH_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)
Public Method
OnObjectChanged(GH_ObjectEventType)
Public Method
OnObjectChanged(String)
Public Method
OnObjectChanged(GH_ObjectEventType, Object)
Public Method
OnObjectChanged(String, 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. You probably want to call ExpireSolution() instead of this method directly.
Public Method
Read
(Overrides
GH_InstanceDescription.Read(GH_IReader)
.)Public Method
ReadFull
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 from GH_InstanceDescription.)
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. Override this method if you want to handle such events.
Public Method
SetIconOverride
Set a new custom icon override for this object.
Protected method
SetValue(String, Boolean)
Set a named value. This value will be serialized with the component.
Protected method
SetValue(String, Double)
Set a named value. This value will be serialized with the component.
Protected method
SetValue(String, Color)
Set a named value. This value will be serialized with the component.
Protected method
SetValue(String, Int32)
Set a named value. This value will be serialized with the component.
Protected method
SetValue(String, String)
Set a named value. This value will be serialized with the component.
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.
Protected method
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.
Public Method
Write
(Overrides
GH_InstanceDescription.Write(GH_IWriter)
.)Public Method
WriteFull
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 from GH_InstanceDescription.)
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
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.
Fields
Name
Description
Protected field
m_attributes