GH_Document

References
Represents a single Grasshopper document.

Constructors

GH_Document

#
public GH_Document()
Constructor for GH_Document. Makes sure all important members are initialized.

Fields

IgnoredUnknowns

#
public static readonly HashSet<Guid> IgnoredUnknowns
A collection of missing component IDs to ignore during file load operations. Erase this cache to re-enable all the load warnings.

ScheduleInactive

#
public const int ScheduleInactive = -1
Defined the delay used to indicate the absence of a schedule.

ScheduleRecursive

#
public const int ScheduleRecursive = 0
Defines the delay used to indicate the schedule should be immedate and recursive.

Properties

AbortRequested

#
public bool AbortRequested { get; }
Gets the AbortRequested flag state.

ActiveDoc

#
public bool ActiveDoc { get; set; }
Gets or sets a value indicating that this document was last active in a multi-doc aware Rhino.
true if this was the last active document; otherwise, false.

AttributeCount

#
public int AttributeCount { get; }
Returns the total number of attributes in the document. Both Normal and Hidden ones

Attributes

#
public IList<IGH_Attributes> Attributes { get; }
Returns a list of all the attributes in this document. This includes attributes for nested objects such as input or output parameters.
Remarks: If the attribute cache is empty, it will be rebuild. Hence, this could be quite an expensive call to make.

Author

#
public IGH_Author Author { get; }
Gets the author details associated with this document.

ConstantServer

#
public SortedDictionary<string, GH_Variant> ConstantServer { get; }
Gets the dictionary of constants defined in this document.

ContainsCustomPreviewObjects

#
public bool ContainsCustomPreviewObjects { get; }
Gets whether this document contains *any* custom preview objects.

ContainsCustomRenderObjects

#
[EditorBrowsable(EditorBrowsableState.Never)] public bool ContainsCustomRenderObjects { get; }
Gets whether this document contains custom preview objects which are both ENABLED and included in RENDERING.

Context

#
public GH_DocumentContext Context { get; set; }
Gets or sets the context for this document. Note that the context is not a state so much as an action. Therefore it is not particularly useful to read the context after the fact, rather, context is mostly intended to be a setter, not a getter. When you set the context, all top-level document objects will be informed and the ContextChanged event will be raised.

CustomRenderObjects

#
[EditorBrowsable(EditorBrowsableState.Never)] public IEnumerable<GH_CustomPreviewComponent> CustomRenderObjects { get; }
Enumerate over all enabled, rendering, non-empty custom preview objects.

DefaultPreviewColour

#
public static Color DefaultPreviewColour { get; set; }
Gets or sets the default preview colour for normal objects.

DefaultSelectedPreviewColour

#
public static Color DefaultSelectedPreviewColour { get; set; }
Gets or sets the default preview colour for normal objects.

DisplayName

#
public string DisplayName { get; }
Gets the display name for this document. The display name is highly context sensitive and is only supposed to give the user a good idea of which document this is and whether it has been modified.

DocumentID

#
public Guid DocumentID { get; }
Gets the document Id. The Id is assigned at construction and never changed. Note: clusters may choose to modify the Id of their internal documents.

Enabled

#
public bool Enabled { get; set; }
Gets or sets the enabled state for this document. Enabled documents respond to events and display their previews in the Rhino viewport.

EnableSolutions

#
public static bool EnableSolutions { get; set; }
Gets or sets a global variable that indicates whether solutions are allowed to be recomputed. When this flag is off, the solver will be disabled and the event watchers should be silent.

EventServer

#
public GH_DocumentEventServer EventServer { get; }
Gets the event server that belongs to this document. The Event server may be in an inactive state, but it is never null.

FileNameProxy

#
[EditorBrowsable(EditorBrowsableState.Never)] public string FileNameProxy { get; }
obsoleteThis property is obsolete, please use the DisplayName property instead

FilePath

#
public string FilePath { get; set; }
Gets or sets the file path of this document. If the file path is not set Nothing is returned.

IgnoredCount

#
public int IgnoredCount { get; }
Returns the total numbers of components currently in the Object Exception Ignore List.

IsFilePathDefined

#
public bool IsFilePathDefined { get; }
Returns True if the filename flag of this document has been set

IsModified

#
public bool IsModified { get; set; }
Gets or sets the modified flag. If the new value differs from the old value, the ModifiedChanged() event is raised.

ModifiedSubsidiaries

#
public int ModifiedSubsidiaries { get; }
Gets the number of modified subsidiary documents.
The number of modified subsidiary documents.

Nested

#
public bool Nested { get; set; }
Gets or sets whether this document is nested. A nested document is always part of some other document and is therefore unknown to the DocumentServer and the Canvas.

ObjectCount

#
public int ObjectCount { get; }
Returns the total number of top-level objects in the document.

Objects

#
public IList<IGH_DocumentObject> Objects { get; }
Returns a list of all normal, top-level objects.

ObjectSpan

#
public TimeSpan ObjectSpan { get; }
Gets the total timespan for all objects.

Owner

#
public IGH_DocumentOwner Owner { get; set; }
Gets or sets the owner of this document. A document is typically owned when it is subsidiary to some object, such as a cluster.

PreviewBoundary

#
public GH_PreviewBoundary PreviewBoundary { get; set; }
Gets or sets the preview boundary applied to this document. If a boundary has been set, only those objects which are inside the boundary will be previewed.

PreviewBoundingBox

#
public BoundingBox PreviewBoundingBox { get; }
Gets the boundingbox used for previews.

PreviewColour

#
public Color PreviewColour { get; set; }
Gets or sets the colour of unselected preview geometry.

PreviewColourSelected

#
public Color PreviewColourSelected { get; set; }
Gets or sets the colour of selected preview geometry.

PreviewCustomMeshParameters

#
public MeshingParameters PreviewCustomMeshParameters { get; set; }
Gets or sets the Custom Meshing Parameters for this document, these are only used when PreviewMeshType = GH_PreviewMesh.Custom

PreviewFilter

#
public GH_PreviewFilter PreviewFilter { get; set; }
Gets or set the preview filter.

PreviewMeshType

#
public GH_PreviewMesh PreviewMeshType { get; set; }
Gets or sets the preview mesh type for this document.

PreviewMode

#
public GH_PreviewMode PreviewMode { get; set; }
Gets or sets the preview display mode and makes sure the conduit instance of this class is set to match.

Profiler

#
public GH_ProfilerMode Profiler { get; set; }
Gets or sets the profiler mode used in this document.

Properties

#
public GH_DocumentProperties Properties { get; }
The properties of this document

RaiseEvents

#
public bool RaiseEvents { get; set; }
If RaiseEvents is set to false, all the On....() methods of this document will stop raising events.

RemotePanelLayout

#
public RcpLayout RemotePanelLayout { get; }
Gets the Remote Control Panel layout for this document.

RhinoDocument

#
public RhinoDoc RhinoDocument { get; }

RuntimeID

#
public ulong RuntimeID { get; }
Gets the runtime ID of this document. RuntimeID is assigned once and never changed. It is also not deserialized so every document will always have a unique ID when loaded.

ScheduleDelay

#
public int ScheduleDelay { get; }
Gets the delay for the next scheduled solution. If there is no solution scheduled the delay will be negative.

SelectedCount

#
public int SelectedCount { get; }
Gets the number of selected objects

SelectionTopology

#
public GH_SelectionTopology SelectionTopology { get; }
Gets the selection topology of the document.

SolutionDepth

#
public int SolutionDepth { get; }
Gets the number of nested solutions currently running. If no solutions are running, the depth should be zero. If one solution is runnnig, the depth should be one. Higher depths are only possible if a new solution was scheduled from within an existing solution with delay=0ms.

SolutionHistory

#
public List<GH_SolutionSpan> SolutionHistory { get; }
Gets a list of the last 1000 solution timespans, from oldest to youngest.

SolutionSpan

#
public TimeSpan SolutionSpan { get; }
Gets the timespan for the most recent solution.

SolutionState

#
public GH_ProcessStep SolutionState { get; }
Gets the state of this document.

StateServer

#
public GH_StateServer StateServer { get; }
Gets the list of stored states in this document

Thumbnail

#
public Bitmap Thumbnail { get; set; }
Gets or sets the thumbnail bitmap for this document.

UndoServer

#
public GH_UndoServer UndoServer { get; }
Gets the UndoServer instance that belongs to this document.

UndoUtil

#
public GH_Document.GH_UndoUtil UndoUtil { get; }
Gets a temporary undo utility instance that allows you to easily create standard undo events.
A new instance of GH_UndoUtil set up to work with this document. Do not hang on to this object, ask for a new one every time you need it.

ValueTable

#
public GH_SettingsServer ValueTable { get; }
Gets the value table associated with this document.

Methods

ActiveObjects

#
public List<IGH_ActiveObject> ActiveObjects()
Returns all normal objects in the document that implement the IGH_ActiveObject interface

AddObject

#
public bool AddObject(IGH_DocumentObject docObject, bool update, int index = 2147483647)
Add a new object to the document. If the object is already contained, nothing will happen
docObject (IGH_DocumentObject)The object to add.
update (bool)If True, a new solution will be triggered afterwards, regardless of event response settings.
index (int = 2147483647)Index at which object will be inserted.

AlignObjects

#
public void AlignObjects(GH_Align align, GH_Distribute distribute, List<IGH_DocumentObject> objs)
Perform alignment and distribution logic on a set of objects.
align (GH_Align)
distribute (GH_Distribute)
objs (List<IGH_DocumentObject>)

AlignObjects

#
public void AlignObjects(GH_Align align, GH_Distribute distribute)
Perform alignment and distribution logic on all selected objects.
align (GH_Align)
distribute (GH_Distribute)

AppendToDebugLog

#
public void AppendToDebugLog(GH_DebugDescriptionWriter writer)
Useful for creating textual representations of this document for debugging purposes.
writer (GH_DebugDescriptionWriter)
AppendToDebugLog

ArrangeObject

#
public bool ArrangeObject(IGH_DocumentObject obj, GH_Arrange motion)
Rearrange the stack order of the object.
obj (IGH_DocumentObject)Object to move.
motion (GH_Arrange)Direction to move in.

ArrangeObjects

#
public bool ArrangeObjects(IEnumerable<IGH_DocumentObject> objs, GH_Arrange motion)
Rearrange the stack order of a collection of objects.
objs (IEnumerable<IGH_DocumentObject>)Objects to move.
motion (GH_Arrange)Direction to move in.

AssociateWithRhinoDocument

#
public void AssociateWithRhinoDocument()
Associate this GH_Document with the currently active Rhino document. This only works if both the 3dm and the ghx file have been saved at least once.

AutoLayoutComponents

#
public void AutoLayoutComponents(bool limitToSelection)
Perform automatic layout on this document.
limitToSelection (bool)If true, only selected objects will be considered.

AutoSave

#
public bool AutoSave(GH_AutoSaveTrigger trigger, Guid id)
Creates a new autosave file on the disk. The previous autosave file (assuming it exists) will be temporarily renamed and eventually deleted entirely. Note: AutoSave is only possible on Documents that have TopLevel Rank and a valid FilePath.
trigger (GH_AutoSaveTrigger)Reason for autosave. User can choose to ignore certain autosave reasons.
id (Guid)Guid of autosave operation, consecutive calls to autosave with the same Guid will be ignored.

AutoSave

#
public bool AutoSave(GH_AutoSaveTrigger trigger)
Creates a new autosave file on the disk. The previous autosave file (assuming it exists) will be temporarily renamed and eventually deleted entirely. Note: AutoSave is only possible on Documents that have TopLevel Rank and a valid FilePath.
trigger (GH_AutoSaveTrigger)Reason for autosave. User can choose to ignore certain autosave reasons.

AutoSaveFileName

#
public static string AutoSaveFileName(string filename)
Computes the autosave filename for a full grasshopper filepath.
filename (string)Full path of Grasshopper file, including directories and extension.
The autosave filename (but not including the autosave directory).

BoundingBox

#
public RectangleF BoundingBox(bool limitToSelection = false)
Returns the boundingbox of all the normal attributes. If the document contains no normal attributes an Empty RectangleF structure is returned.
limitToSelection (bool = false)If true, only selected attributes are included in the boundingbox computation.
The boundingbox of the requested objects or RectangleF.Empty if no objects could be found.

BringSelectionToTop

#
public void BringSelectionToTop()
Move the selection set to the top of the visible stack

ClearIgnoreList

#
public void ClearIgnoreList()
Clears the Object Exception Ignore List.

ClearReferenceTable

#
public void ClearReferenceTable()
Destroys the Referenced object table in the Rhino event watcher. You must call this function if you either add or remove a reference to a Rhino object.

CloseAllSubsidiaries

#
public int CloseAllSubsidiaries()
Iterate over all subsidiary documents and close them all without saving.
The number of subsidiary documents that was closed.

ClusterInputHooks

#
public GH_ClusterInputHook[] ClusterInputHooks()
Gets a sorted list of all the cluster input hooks.
A list of hooks in the proper order (from top to bottom, left to right).

ClusterInstanceCount

#
public int ClusterInstanceCount(Guid id)
Counts the number of instances of a specific cluster document ID.
id (Guid)The cluster document id to search for.
The number of instances of a specific cluster.

ClusterOutputHooks

#
public GH_ClusterOutputHook[] ClusterOutputHooks()
Gets a sorted list of all the cluster output hooks.
A list of hooks in the proper order (from top to bottom, left to right).

CompareTo

#
public int CompareTo(GH_Document other)
Compare two documents. This function does not compare document content.
other (GH_Document)Document to compare to.
Comparison key.

ConstructDocumentTree

#
public GH_DocumentTree ConstructDocumentTree()
Create a hierarchical document tree of ownership with this document as the root.
A tree of all documents owned directly or indirectly by this document.

ContainsClusterHooks

#
public bool ContainsClusterHooks()
Tests whether this document contains at least one cluster hook.

ConvertFullNamesToNickNames

#
public void ConvertFullNamesToNickNames()
Convert all nicknames to original nicknames if they are equal to the default full name. There will be no undo record associated with this operation.

ConvertNickNamesToFullNames

#
public void ConvertNickNamesToFullNames()
Convert all nicknames to full names, if they are equal to the default nickname. There will be no undo record associated with this operation.

CreateAutomaticClusterHooks

#
public void CreateAutomaticClusterHooks()
Add an input hook for every non-optional input parameter with no persistent data and no sources. Then add an output hook for every floating parameter without recipients, and for every first component output parameter where the parent component has no recipients.

CreateConnectivityDiagram

#
public GH_ConnectivityDiagram CreateConnectivityDiagram()
Gets the connectivity diagram for the current state of this document.
The connectivity diagram of the current state. Once objects/wires are added or removed the diagram will not update and you must request a new one.

CreateExpressionParser

#
public GH_ExpressionParser CreateExpressionParser()
Create a new Expression Solver preloaded with the constants defined in this document.

DefineConstant

#
public void DefineConstant(string name, GH_Variant value)
Add a new constant to the document. Constants are not case-sensitive, when you define a constant with an existing name, the old one will be replaced. Note: constants are as of yet unused. Eventually they are supposed to become accessible to all expressions running inside a document.
name (string)Name of constant.
value (GH_Variant)Value of constant.

DeselectAll

#
public void DeselectAll()
Deselect all top-level attributes.

DestroyAttributeCache

#
public void DestroyAttributeCache()
Destroys the Attribute cache. Call this function whenever you do something which might affect attributes.

DestroyAutoSaveFiles

#
public void DestroyAutoSaveFiles()
Destroys all autosave files and backup files that are associated with this document. Only call this function when you are certain that the document has been properly saved and no changes have occured since.

DestroyObjectTable

#
public void DestroyObjectTable()
Erase the Object fast lookup table. You must call this whenever you add or remove objects to or from the document while circumventing the regular channels.

DestroyPreviewCaches

#
public void DestroyPreviewCaches()
Wipe all caches for Viewport Preview logic.

DestroyPreviewMeshes

#
public void DestroyPreviewMeshes()
Attempts to destroy all the preview meshes in this document. It might not work for all objects, but this is still your best bet.

DestroyProxySources

#
public void DestroyProxySources()
Remove all remaining proxy sources from the document.

DisabledObjects

#
public List<IGH_DocumentObject> DisabledObjects()
Returns all disabled objects in the document

Dispose

#
public void Dispose()
When you discard documents you must call Dispose or the Viewport Display event handlers will not be disconnected.

DuplicateDocument

#
public static GH_Document DuplicateDocument(GH_Document doc)
Attempt to duplicate a document.
doc (GH_Document)Document to copy.
A document similar to the input on success, or nothing on failure.

EnabledObjects

#
public List<IGH_DocumentObject> EnabledObjects()
Returns all enabled objects in the document

ExpandSelection

#
public void ExpandSelection(bool Upstream = true, bool Downstream = true, bool GrowSelection = true)
Grow or shift the selection set based on source and recipient links
Upstream (bool = true)If True, the selection will grow/shift upstream
Downstream (bool = true)If True, the selection will grow/shift downstream
GrowSelection (bool = true)If True, the current selection set is retained. If False, the current selection set is discarded

ExpirePreview

#
public void ExpirePreview(bool redraw)
Expires the preview caches of the conduit.
redraw (bool)

ExpireSolution

#
public void ExpireSolution()
Expire the entire solution. This will blank all objects.

FilterActive

#
public static List<IGH_ActiveObject> FilterActive(List<IGH_DocumentObject> in)
Filter a list of objects.
in (List<IGH_DocumentObject>)The object list to filter
A list containing only the objects that implement the IGH_ActiveObject interface

FilterDisabled

#
public static List<IGH_DocumentObject> FilterDisabled(List<IGH_DocumentObject> in)
Filter a list of objects.
in (List<IGH_DocumentObject>)The object list to filter
A list containing only the disabled objects

FilterEnabled

#
public static List<IGH_DocumentObject> FilterEnabled(List<IGH_DocumentObject> in)
Filter a list of objects.
in (List<IGH_DocumentObject>)The object list to filter
A list containing only the enabled objects

FilterInactive

#
public static List<IGH_ActiveObject> FilterInactive(List<IGH_DocumentObject> in)
Filter a list of objects.
in (List<IGH_DocumentObject>)The object list to filter
A list containing only the objects that don't implement the IGH_ActiveObject interface

FilterObjects

#
public List<IGH_DocumentObject> FilterObjects(GH_Filter selectedObjects = GH_Filter.DontCare, GH_Filter enabledObjects = GH_Filter.DontCare, GH_Filter activeObjects = GH_Filter.DontCare)
Returns all objects in the document that pass the filter specification
selectedObjects (GH_Filter = GH_Filter.DontCare)
enabledObjects (GH_Filter = GH_Filter.DontCare)
activeObjects (GH_Filter = GH_Filter.DontCare)

FilterObjects

#
public static List<IGH_DocumentObject> FilterObjects(List<IGH_DocumentObject> in, GH_Filter bSelectedObjects = GH_Filter.DontCare, GH_Filter bEnabledObjects = GH_Filter.DontCare, GH_Filter bActiveObjects = GH_Filter.DontCare)
Filter a list of objects using several filters at once
in (List<IGH_DocumentObject>)The set to filter
bSelectedObjects (GH_Filter = GH_Filter.DontCare)Filter (non)selected objects only
bEnabledObjects (GH_Filter = GH_Filter.DontCare)Filter (non)enabled objects only
bActiveObjects (GH_Filter = GH_Filter.DontCare)Filter (non)active objects only
A list with all objects that pass all filters

FilterSelected

#
public static List<IGH_DocumentObject> FilterSelected(List<IGH_DocumentObject> in)
Filter a list of objects.
in (List<IGH_DocumentObject>)The object list to filter
A list containing only the selected objects

FilterUnselected

#
public static List<IGH_DocumentObject> FilterUnselected(List<IGH_DocumentObject> in)
Filter a list of objects.
in (List<IGH_DocumentObject>)The object list to filter
A list containing only the unselected objects

Finalize

#
protected override void Finalize()
Object.Finalize

FindAllDownstreamObjects

#
public List<IGH_ActiveObject> FindAllDownstreamObjects(IGH_ActiveObject from, GH_ActiveObjectFilter filter)
Find all objects that depend in some way on the Source.
from (IGH_ActiveObject)Object to start searching from.
filter (GH_Document.GH_ActiveObjectFilter)The inclusion delegate

FindAllDownstreamObjects

#
public List<IGH_ActiveObject> FindAllDownstreamObjects(IGH_ActiveObject from)
Find all objects that depend in some way on the Source.
from (IGH_ActiveObject)Object to start searching from.

FindAllDownstreamObjects

#
public List<IGH_ActiveObject> FindAllDownstreamObjects(List<IGH_ActiveObject> from, GH_ActiveObjectFilter filter)
Find all objects that depend in some way on the Source collection
from (List<IGH_ActiveObject>)Objects to start searching from.
filter (GH_Document.GH_ActiveObjectFilter)The inclusion delegate

FindAllDownstreamObjects

#
public List<IGH_ActiveObject> FindAllDownstreamObjects(List<IGH_ActiveObject> from)
Find all objects that depend in some way on the Source collection
from (List<IGH_ActiveObject>)Objects to start searching from.

FindAttribute

#
public IGH_Attributes FindAttribute(Guid id)
Find the object that matches the ID
id (Guid)the ID to search for

FindAttribute

#
public IGH_Attributes FindAttribute(PointF pt, bool topLevelOnly)
Search for attributes that contain a certain point.
pt (PointF)The point in Canvas coordinates
topLevelOnly (bool)If true, child attributes will be skipped.

FindAttributeByGrip

#
public IGH_Attributes FindAttributeByGrip(PointF pt, bool bLimitToOutside, bool bIncludeInputs, bool bIncludeOutputs, int SearchRadius = 12)
Search for attributes that contain grips near the search locus
pt (PointF)Pixel for search start
bLimitToOutside (bool)If true, grips are ignored if the pt is on the 'inside' side.
bIncludeInputs (bool)
bIncludeOutputs (bool)
SearchRadius (int = 12)Radius of search

FindAttributeByGrip

#
public IGH_Attributes FindAttributeByGrip(PointF pt, bool bLimitToOutside, int SearchRadius = 12)
Search for attributes that contain grips near the search locus
pt (PointF)Pixel for search start
bLimitToOutside (bool)If true, grips are ignored if the pt is on the 'inside' side.
SearchRadius (int = 12)Radius of search

FindClusters

#
public List<GH_Cluster> FindClusters(Guid id)
Find all the clusters that have a matching ID.
id (Guid)Cluster DocumentID to search for.
A list of all the clusters that match the ID.

FindClusters

#
public List<GH_Cluster> FindClusters(string filepath)
Find all the clusters that have a matching filepath.
filepath (string)Cluster FilePath to search for.
A list of all the clusters that match the filepath.

FindComponent

#
public IGH_Component FindComponent(Guid id)
Search for components using an ID filter
id (Guid)ID to search for
The component with the ID, or Null if no component could be found

FindComponent

#
public IGH_Component FindComponent(Point pt)
Search for components that contain the locus
pt (Point)The point to search for

FindFloatingParameter

#
public IGH_Param FindFloatingParameter(Point pt)
Search for floating parameters that contain the locus
pt (Point)Point for search start

FindInputParameter

#
public IGH_Param FindInputParameter(Point pt)
Search for input (upstream) parameters that contain the locus
pt (Point)Point for search start

FindObject

#
public IGH_DocumentObject FindObject(Guid id, bool topLevelOnly)
Find the object that matches the ID.
id (Guid)The ID to search for.
topLevelOnly (bool)If True, only top-level objects are included. If False, the entire object attribute tree is recursed

FindObject

#
public IGH_DocumentObject FindObject(PointF pt, float radius)
Find the topmost object that is closest to the point
pt (PointF)Canvas coordinates for object lookup
radius (float)Radius, (in canvas units) for search.

FindObject<T>

#
public T FindObject<T>(Guid id, bool topLevelOnly)
Find the object that matches the ID.
id (Guid)The ID to search for.
topLevelOnly (bool)If True, only top-level objects are included. If False, the entire object attribute tree is recursed

FindObjects

#
public List<IGH_DocumentObject> FindObjects(List<string> keys, int maxCount)
Find the objects in the document that match the search term. Top level object names and nicknames are searched, as well as descriptions. Some objects are special cased to allow for more targeted searches. Data descriptions are not searched.
keys (List<string>)
maxCount (int)

FindOutputParameter

#
public IGH_Param FindOutputParameter(Point pt)
Search for output (downstream) parameters that contain the locus
pt (Point)Point for search start

FindParameter

#
public IGH_Param FindParameter(Guid id)
Search for parameters using an ID filter
id (Guid)ID to search for
The parameter with the ID, or Null if no parameter could be found

FindWireAt

#
public bool FindWireAt(PointF point, float radius, ref IGH_Param source, ref IGH_Param target)
Find the wire at or near the given coordinate.
point (PointF)Search locus.
radius (float)Search radius.
source (ref IGH_Param)Source parameter of wire (if found).
target (ref IGH_Param)Target parameter of wire (if found).
True if a wire was found.

ForcePreview

#
public void ForcePreview(bool previewOn)
If true, the document will draw viewport previews regardless of other conditions. Typically a document only previews if it is loaded in the canvas or when it has an RCP.
previewOn (bool)

GetAllInstanceIDs

#
public SortedList<Guid, int> GetAllInstanceIDs(bool topLevelOnly)
Get a sorted list of all the IGH_DocumentObject instance IDs in this document.
topLevelOnly (bool)If true, only top level objects are considered.
A sorted fictionary of IDs and Integers. The integers represent the indices of the top-level objects that contained the ids. Since the object list inside a GH_Document is not static, these indices will not remain valid.

InactiveObjects

#
public List<IGH_ActiveObject> InactiveObjects()
Returns all objects in the document that don't implement the IGH_ActiveObject interface

InvertSelection

#
public void InvertSelection()
Invert the selected state of all top-level attributes.

IsEscapeKeyDown

#
public static bool IsEscapeKeyDown()
Gets whether the escape key was pressed since the last time this function was called. Though in reality the actual escape state is checked no more than once every 50 milliseconds or so, which should be sufficient for a smooth user experience.
Remarks: If GetAsyncKeyState is called by some other application, it will mess with the value returned here, as GetAsyncKeyState is a system wide static method.
True if escape was/is pressed, false if otherwise.

IsRenderMeshPipelineViewport

#
public bool IsRenderMeshPipelineViewport(DisplayPipeline pipeline)
Test to see whether a pipeline should have custom render meshes vs. previews.
pipeline (DisplayPipeline)Display pipeline.
True if custom meshes ought to be used rather than previews.

MergeDocument

#
public bool MergeDocument(GH_Document other, bool resolveProxies, bool removeProxies)
Hoist all objects from another document into this one.
Remarks: The objects will be moved, not copied. The other document ends up being empty since objects can only belong to one document at a time.
other (GH_Document)The other document. Cannot be null.
resolveProxies (bool)If True, an attempt is made to repair proxy sources after insertion.
removeProxies (bool)If True, all remaining proxies will be deleted.

MergeDocument

#
public bool MergeDocument(GH_Document other, bool resolveProxies)
Hoist all objects from another document into this one.
Remarks: The objects will be moved, not copied. The other document ends up being empty since objects can only belong to one document at a time.
other (GH_Document)The other document. Cannot be Null or
resolveProxies (bool)If True, an attempt is made to repair proxy sources after insertion.

MergeDocument

#
public bool MergeDocument(GH_Document other)
Hoist all objects from another document into this one.
Remarks: The objects will be moved, not copied. The other document ends up being empty since objects can only belong to one document at a time.
other (GH_Document)The other document. Cannot be Null or

Modified

#
public void Modified()
Sets the modified flag of this document.

MutateAllGUIDs

#
[EditorBrowsable(EditorBrowsableState.Never)] public void MutateAllGUIDs()
obsoleteThis method has been replaced by MutateAllIds

MutateAllIds

#
public void MutateAllIds()
Change all the instance UUIDs of all objects in the document. Be sure to resolve all proxy sources before mutating IDs. This function will ensure all groups are updated appropriately.

NewSolution

#
public void NewSolution(bool expireAllObjects, GH_SolutionMode mode)
Start a new solution.
expireAllObjects (bool)If True, all objects will be recalculated. If False, only already expired objects will be recalculated.
mode (GH_SolutionMode)Solution mode. Only use CommandLine or Silent if your solution runs in the background.

NewSolution

#
public void NewSolution(bool expireAllObjects)
Start a new solution.
expireAllObjects (bool)If True, all objects will be recalculated. If False, only already expired objects will be recalculated.

NonBlankFilter

#
public static bool NonBlankFilter(IGH_ActiveObject iObj)
This delegate can be used in the FindAllDownstreamObjects(...) methods. Only includes objects that are non-blank and non-failed.
iObj (IGH_ActiveObject)

NullFilter

#
public static bool NullFilter(IGH_ActiveObject iObj)
This delegate can be used in the FindAllDownstreamObjects(...) methods. Includes all objects.
iObj (IGH_ActiveObject)

OnContextChanged

#
public void OnContextChanged()
Raise the ContextChanged event.

OnEnabledChanged

#
public void OnEnabledChanged()
Raise the EnabledChanged event.

OnFilePathChanged

#
public void OnFilePathChanged(string old, string new)
Raise the FilePathChanged event.
old (string)Old filepath.
new (string)New filepath.

OnModifiedChanged

#
public void OnModifiedChanged()
Raise the ModifiedChanged event

OnObjectAdded

#
public void OnObjectAdded(IGH_DocumentObject doc_object)
Raise the ObjectsAdded event.
doc_object (IGH_DocumentObject)Object that was added.

OnObjectDeleted

#
public void OnObjectDeleted(IGH_DocumentObject doc_object)
Raise the ObjectsDeleted event.
doc_object (IGH_DocumentObject)Object that was deleted.

OnObjectsAdded

#
public void OnObjectsAdded(IEnumerable<IGH_DocumentObject> doc_objects)
Raise the ObjectsAdded event.
doc_objects (IEnumerable<IGH_DocumentObject>)Objects that were added.

OnObjectsDeleted

#
public void OnObjectsDeleted(IEnumerable<IGH_DocumentObject> doc_objects)
Raise the ObjectsDeleted event.
doc_objects (IEnumerable<IGH_DocumentObject>)Objects that were deleted.

OnSettingsChanged

#
public void OnSettingsChanged(GH_DocumentSettings kind)
Raise the SettingsChanged event.
kind (GH_DocumentSettings)

OnUndoStateChanged

#
public void OnUndoStateChanged(GH_UndoOperation op, GH_UndoRecord rec)
Raise the UndoStateChanged event.
op (GH_UndoOperation)Type of undo operation to provide with the Event arguments.
rec (GH_UndoRecord)Record to provide in the Event arguments.

PreviewCurrentMeshParameters

#
public MeshingParameters PreviewCurrentMeshParameters()
Gets the currently relevant meshing parameters (do not modify the instance as it may be shared).

Read

#
public bool Read(GH_IReader reader)
Standard archiving function. Will deserialize the entire document.
reader (GH_IReader)
Read

Redo

#
public bool Redo()
Perform the first redo event.
True on success, false on no redo event or invalid redo event.

RelevantObjectAtPoint

#
public GH_RelevantObjectData RelevantObjectAtPoint(PointF pt, GH_RelevantObjectFilter searchFilter)
Find the most relevant object at a given canvas location. The most relevant object might be a regular Object (Component or Parameter), it might be an attribute grip, an attribute balloon, a wire or a group.
pt (PointF)The point to test.
searchFilter (GH_RelevantObjectFilter)
Information about the most relevant object or Null if no relevant object could be found at the given point.

RelevantObjectAtPoint

#
public GH_RelevantObjectData RelevantObjectAtPoint(PointF pt)
Find the most relevant object at a given canvas location. The most relevant object might be a regular Object (Component or Parameter), it might be an attribute grip, an attribute balloon, a wire or a group.
pt (PointF)The point to test.
Information about the most relevant object or Null if no relevant object could be found at the given point.

RemoveObject

#
public bool RemoveObject(IGH_Attributes attribute, bool update)
Remove the top-level object in the attribute tree from the document. This method does not add an Undo event, that is the responsibility of the caller.
attribute (IGH_Attributes)
update (bool)

RemoveObject

#
public bool RemoveObject(IGH_DocumentObject docObject, bool update)
Remove the object from the document. This removal is the precursor to object deletion. Do not call this function if you intend to transfer the object to another GH_Document. This method does not add an Undo event, that is the responsibility of the caller.
docObject (IGH_DocumentObject)Object to remove.
update (bool)

RemoveObjects

#
public int RemoveObjects(IEnumerable<IGH_DocumentObject> objectList, bool update)
Remove the specified objects from the document. This removal is the precursor to object deletion. Do not call this function if you intend to transfer the objects to another GH_Document. This method does not add an Undo event, that is the responsibility of the caller.
objectList (IEnumerable<IGH_DocumentObject>)Objects to remove from this document.
update (bool)If True, the solution will be recomputed.
The number of objects actually deleted.

RemoveSelection

#
public void RemoveSelection(bool update)
Delete all the objects in the selection set. This method does not record an Undo event, that is the responsibility of the caller.
update (bool)If True, the solution will be recomputed.

RepairProxySources

#
public bool RepairProxySources()
Attempts to resolve all proxy sources in the document.
False if one or more proxies could not be resolved

ReplaceProxySources

#
public void ReplaceProxySources()
Replace all remaining proxy sources in the document with UnresolvedProxy Objects.

RequestAbortSolution

#
public void RequestAbortSolution()
Set the AbortRequested flag. The solution will be aborted whenever the current active object is completed. It is also possible that active objects themselves implement an abortion mechanism, in which case abortion might occur even sooner.

RunningAsCommand

#
public Command RunningAsCommand()
When the document is being solved inside the context of an executing Rhino command, this function will return the command instance. Under normal operation of Grasshopper in the traditional sense, this function will return null. The document executes as a command when inside of the grasshopper player or as a compiled grasshopper player based command. The way to run a GH_Document as a command is to call the GH_RhinoScriptInterface.RunAsCommand function
executing command when running as a command; otherwise null

ScheduleSolution

#
public void ScheduleSolution(int delay, GH_ScheduleDelegate callback)
Schedule a new solution after a specified time interval. The schedule is erased if another solution is triggered before the schedule is executed. Tight schedules override loose schedules. If this method is called during a solution, the schedule will be started after the current solution completes.
delay (int)The delay (in milliseconds) between the completion of this solution and the start of the scheduled solution. If the delay is 1ms or more, a timer will be used to trigger a new solution sometime in the future. If a delay of 0ms is used, then the next solution will run recursively within the current solution. You should not use a delay of zero milliseconds too often as it will cause the Rhino process to run out of stack-space. The SolutionDepth property can be used to see how deeply recursive the solution currently is.
callback (GH_Document.GH_ScheduleDelegate)If not null, the callback will be called before the scheduled solution is triggered.

ScheduleSolution

#
public void ScheduleSolution(int delay)
Schedule a new solution after a specified time interval. The schedule is erased if another solution is triggered before the schedule is executed. Tight schedules override loose schedules. If this method is called during a solution, the schedule will be started after the current solution completes.
delay (int)The delay (in milliseconds) between the completion of this solution and the start of the scheduled solution. If the delay is 1ms or more, a timer will be used to trigger a new solution sometime in the future. If a delay of 0ms is used, then the next solution will run recursively within the current solution. You should not use a delay of zero milliseconds too often as it will cause the Rhino process to run out of stack-space. The SolutionDepth property can be used to see how deeply recursive the solution currently is.

Select

#
public GH_SelectionState Select(GH_RelevantObjectData obj_dat, bool bAdd, bool bRemove)
Default pick selection behaviour
obj_dat (GH_RelevantObjectData)Information regarding the object to be selected.
bAdd (bool)If True, it will add the topmost unselected object that contains pt to the selection set. If False, the selection set will be cleared when an unselected object is picked
bRemove (bool)If True, it will remove the topmost selected object that contains pt from the selection set.

Select

#
Default pick selection behaviour. (looks at current Shift + Control modifier states to determine addition/removal)
obj_dat (GH_RelevantObjectData)Information regarding the object to be selected.

SelectAll

#
public void SelectAll()
Select all top-level attributes.

SelectedObjects

#
public List<IGH_DocumentObject> SelectedObjects()
Returns all selected objects in the document

SetEnabledFlags

#
public void SetEnabledFlags(bool bEnable)
Set the enabled flags of all selected objects to true or false
bEnable (bool)

SetEnabledFlags

#
public void SetEnabledFlags(List<IGH_DocumentObject> objects, bool bEnable)
Set the enabled flags of all specified objects to true or false
objects (List<IGH_DocumentObject>)
bEnable (bool)

SetPreviewFlags

#
public void SetPreviewFlags(bool bPreview)
Set the preview flags of all selected objects to true or false
bPreview (bool)

SetPreviewFlags

#
public void SetPreviewFlags(List<IGH_DocumentObject> objects, bool bPreview)
Set the preview flags of all specified objects to true or false
objects (List<IGH_DocumentObject>)
bPreview (bool)

SetStatusBarEventHelper

#
public void SetStatusBarEventHelper(GH_RuntimeMessage message)
message (GH_RuntimeMessage)

ShowPreviewSettings

#
public void ShowPreviewSettings()
Display the Preview settings dialog.

SolutionProgress

#
public int SolutionProgress(ref int objectIndex, ref int maximumIndex)
Returns the progress of the current solution.
objectIndex (ref int)The index of the object currently being solved.
maximumIndex (ref int)The highest index.
Percentage of solution as a number between 1 and 99 inclusive.

ToggleEnabledFlags

#
public void ToggleEnabledFlags()
Toggle the enabled flags of all selected objects

ToggleEnabledFlags

#
public void ToggleEnabledFlags(List<IGH_DocumentObject> objects)
Toggle the enabled flags of all specified objects
objects (List<IGH_DocumentObject>)

TogglePreviewFlags

#
public void TogglePreviewFlags()
Toggle the preview flags of all selected objects

TogglePreviewFlags

#
public void TogglePreviewFlags(List<IGH_DocumentObject> objects)
Toggle the preview flags of all specified objects
objects (List<IGH_DocumentObject>)

ToString

#
public override string ToString()
A document serializes itself using the filename of the current path. This is useful for sorting purposes and ListBoxes.
Object.ToString

TranslateObjects

#
public void TranslateObjects(Size trXForm, bool bLimitToSelection)
Offset objects by a certain distance in X and Y
trXForm (Size)Translation vector
bLimitToSelection (bool)If True, only selected objects are affected

Undo

#
public bool Undo()
Perform the first undo event.
True on success, false on no undo event or invalid undo event.

UnselectedObjects

#
public List<IGH_DocumentObject> UnselectedObjects()
Returns all unselected objects in the document

UpdateAllSubsidiaries

#
public int UpdateAllSubsidiaries()
Iterate over all subsidiary documents and update them with their respective owners. If a subsidiary hasn't been modified, it will not be updated and it will not be counted.
The number of subsidiary documents updated.

Write

#
public bool Write(GH_IWriter writer, IList<IGH_DocumentObject> objList)
Special function that allows writing of a custom object list. This function is used when partial documents need to be serialized such as when exporting or during clipboard operations.
writer (GH_IWriter)Writer to serialize with.
objList (IList<IGH_DocumentObject>)Object list override

Write

#
public bool Write(GH_IWriter writer)
Standard archiving function. Will serialize the entire document.
writer (GH_IWriter)
Write

Events

ContextChanged

#
public event GH_Document.ContextChangedEventHandler ContextChanged
The context for this document was changed.

DefaultPreviewColourChanged

#
public static event GH_Document.DefaultPreviewColourChangedEventHandler DefaultPreviewColourChanged
This even is raised whenever the global default for Normal preview colour is changed.

DefaultSelectedPreviewColourChanged

#
public static event GH_Document.DefaultSelectedPreviewColourChangedEventHandler DefaultSelectedPreviewColourChanged
This even is raised whenever the global default for Selected preview colour is changed.

EnabledChanged

#
public event GH_Document.EnabledChangedEventHandler EnabledChanged
The Enabled state was changed on this document.

EnableSolutionsChanged

#
public static event GH_Document.EnableSolutionsChangedEventHandler EnableSolutionsChanged
Raised whenever the Shared EnabledSolutions property is changed.

FilePathChanged

#
public event GH_Document.FilePathChangedEventHandler FilePathChanged
Raised whenever the FilePath of the document is modified.

ModifiedChanged

#
public event GH_Document.ModifiedChangedEventHandler ModifiedChanged
The modified flag on the document was changed.

ObjectsAdded

#
public event GH_Document.ObjectsAddedEventHandler ObjectsAdded
Raised after a collection of objects was added to the document.

ObjectsDeleted

#
public event GH_Document.ObjectsDeletedEventHandler ObjectsDeleted
Raised after a collection of objects was removed from the document. At this point, the objects still exist, but they no longer belong to this document.

SettingsChanged

#
public event GH_Document.SettingsChangedEventHandler SettingsChanged
Some settings of the document were changed.

SolutionEnd

#
public event GH_Document.SolutionEndEventHandler SolutionEnd
This event is raised whenever a new solution request has been handled. Even if the document is locked.

SolutionStart

#
public event GH_Document.SolutionStartEventHandler SolutionStart
This event is raised whenever a new solution is requested. Even if the document is locked.

UndoStateChanged

#
public event GH_Document.UndoStateChangedEventHandler UndoStateChanged
Raised whenever there is a change to the document undo/redo stack.