IDocumentObject

References
public interface IDocumentObject : IStorable
Defines the rules and regulations for any object that wishes to be part of an IDocument.

Properties

Activity

#
ObjectActivity Activity { get; set; }
Gets or sets the active state of this object. Note that this property is meaningless for certain types of object.

Attributes

#
IAttributes Attributes { get; }
Gets or sets the attributes for this object. It is possible that an object does not have attibutes. Only objects that are drawn on the canvas are guaranteed to have attributes.

ChildrenObjects

#
IEnumerable<IDocumentObject> ChildrenObjects { get; }
Gets all immediate child objects that belong to the current object. It is possible that an object does not have any children, and it is possible that a child object has children of its own.

Connectivity

#
IObjectConnectivity Connectivity { get; }
Gets the topological description of this object. The topology is not updated automatically, so be sure to get a fresh instance every time you need it.

CustomValues

#
KeyedValues CustomValues { get; }
Gets a collection of keyed values which can be used to store custom data which will survive (de)serialisation.

Display

#
ObjectDisplay Display { get; set; }
Gets or sets the display state of this object. Note that this property is meaningless for certain types of object.

DisplayCapable

#
bool DisplayCapable { get; }
Gets whether this object makes allowance for 3D viewport displays.

DisplayName

#
string DisplayName { get; }
Gets the display name of this object. Often the DisplayName is identical to the UserName, but there could be more complicated algorithms involved.

DisplayStyle

#
ObjectDisplayStyle DisplayStyle { get; set; }
Gets or sets the display style to use for the geometric data inside this object. Note that this property is meaningless for certain types of object.

Document

#
Document Document { get; set; }
Gets the document this object belongs to. It is possible an object does not belong to any document. Do not assign or remove document associations unless you know exactly what you are doing.

EntireFamily

#
IEnumerable<IDocumentObject> EntireFamily { get; }
Enumerates over all objects in the hierarchy this object is part of. This enumeration starts at the root object and then continues over all children and grandchildren in a breadth-first fashion.

FoundingObject

#
IDocumentObject FoundingObject { get; }
Gets the root or founding object in the object hierarchy. If the current object does not have a parent, it is a founding object.

Icon

#
IIcon Icon { get; }
Gets the icon associated with this object.

InstanceId

#
Guid InstanceId { get; set; }
Gets or sets the instance Id for this object. The instance Id should be different for every instance of every type. Do *not* assign this Id unless you know exactly what you are doing.

Nomen

#
Nomen Nomen { get; }
Gets the user friendly description of this object.

Obsolete

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

ParentObject

#
IDocumentObject ParentObject { get; set; }
Gets or sets the parent object that owns this object. Top-level objects do not have parents. Do not assign or remove parents unless you know exactly what you are doing.

Phase

#
Phase Phase { get; }
Gets the current solution phase of this object.

ProgressPercentage

#
int ProgressPercentage { get; }
Gets an object progress percentage while the object is computing. The Grasshopper UI may or may not choose to display this percentage somewhere.

Relevance

#
ObjectRelevance Relevance { get; set; }
Gets or sets the auxiliary state of this object. Auxiliary objects are drawn in an inconspicuous way as they are considered in-between logic. Note that this property is meaningless for certain types of object.

Selected

#
bool Selected { get; }
Gets the main yes/no state from the SelectionState.

Selection

#
ObjectSelection Selection { get; set; }
Gets or sets the selected state of this object. Note that the selected setting of secondary objects is inherited from the parent.

SiblingObjects

#
IEnumerable<IDocumentObject> SiblingObjects { get; }
Gets all sibling objects in the object family tree.

State

#
ObjectSolutionState State { get; }
Gets the current solution state of this object.

UserName

#
string UserName { get; set; }
Gets the user specified name of this object.

Methods

AddUndoRecord

#
void AddUndoRecord(Record record)
Add a custom undo record for this object.
record (Record)Undo record to add.
Id of undo record.

AddUndoRecord

#
void AddUndoRecord(VerbNoun name, Action action)
Add a single action undo record for this object.
name (VerbNoun)Name of undo record.
action (Action)Specific action to undo.
Id of undo record.

AppendToInputPanel

#
void AppendToInputPanel(InputPanel panel)
Append the object specific items to an existing input panel.
panel (InputPanel)

Compute

#
SolutionData Compute(Solution solution, CallStack stack)
Compute a new solution for this object, or return a completed solution if one is available.
solution (Solution)Document solution info.
stack (CallStack)Call stack leading up to this call.
Result of computation.

DisplayBounds

#
BoundingBox DisplayBounds()
Gets the bounds of the geometry this object might display.

DisplayFaces

#
void DisplayFaces(DisplayPipeline pipeline, Guises guises, ref BoundingBox extents)
Draw the shaded faces for this object.
pipeline (DisplayPipeline)
guises (Guises)
extents (ref BoundingBox)

DisplayWires

#
void DisplayWires(DisplayPipeline pipeline, Guises guises, ref BoundingBox extents)
Draw the wires for this object.
pipeline (DisplayPipeline)
guises (Guises)
extents (ref BoundingBox)

Expire

#
void Expire()
Expire this object and all objects that depend on it. This will request-cancel any running solutions inside whatever document contains this object.

GetCreationInfo

#
bool GetCreationInfo(out string userName, out DateTime time)
Gets information about who created this component and when.
userName (out string)Name of creator.
time (out DateTime)Time of creation in UTC coordinates.
True if the creation data was available.

GetModificationInfo

#
bool GetModificationInfo(out string userName, out DateTime time)
Gets information about who last modified this component and when.
userName (out string)Name of modifier.
time (out DateTime)Time of modification in UTC coordinates.
True if the modification data was available.

ModifyIcon

#
void ModifyIcon(IIcon newIcon, bool overrideExtrinsicIcon = true)
Override the icon for this object. Use this judiciously.
newIcon (IIcon)New icon to assign, or null to revert to the default icon.
overrideExtrinsicIcon (bool = true)If true, the permanent extrinsic icon will be overwritten. If false, the temporary intrinsic icon will be overwritten.

ModifyNameAndInfo

#
void ModifyNameAndInfo(string name = null, string info = null)
Programmatically modify the nickname, name and/or info strings on the Nomen.
name (string = null)New name if not null.
info (string = null)New info if not null.

OnDisplayChanged

#
void OnDisplayChanged()
Raise the DisplayChanged event.

OnLayoutChanged

#
void OnLayoutChanged()
Raise the LayoutChanged event.

OverrideAttributes

#
bool OverrideAttributes(IAttributes attributes)
Assign new attributes to this object. Not all attributes may be accepted, it depends on the implementation.
attributes (IAttributes)New attributes to assign. Assigning null will revert to default attributes.
True if attributes were accepted.

RequestAutoSave

#
AutoSaveResult RequestAutoSave(AutoSaveReason reason, Guid autosaveId)
Request an autosave.
reason (AutoSaveReason)Autosave reason.
autosaveId (Guid)Autosave Id. Consecutive requests with identical Ids are ignored.

RequestAutoSave

#
AutoSaveResult RequestAutoSave(AutoSaveReason reason)
Request an autosave using the instance ID of this object as a filter. This means hat subsequent autosave requests coming from the same object will be ignored.
reason (AutoSaveReason)

SetCreationInfo

#
void SetCreationInfo()
Set the CreatedBy and CreatedAt fields if they haven't been set already.

SetModificationInfo

#
void SetModificationInfo()
Set the ModifiedBy and ModifiedAt fields.

Store

void Store(IWriter writer)
This method is called whenever the instance is required to serialize itself.
inherited fromIStorable
writer (IWriter)Writer object to serialize with.

UpdateDisplay

#
void UpdateDisplay(SolutionData data, DisplayRules rules, CancellationToken token)
Recreate the display caches based on the given solution data and display rules.
data (SolutionData)Data from which to extract display caches.
rules (DisplayRules)Optional display rules.
token (CancellationToken)Cancellation token.

Events

ActivityChanged

#
event EventHandler<ObjectEventArgs> ActivityChanged
Raised whenever the Enabled state of this object changes.

AutosaveRequested

#
event EventHandler<ObjectAutoSaveEventArgs> AutosaveRequested
Raised whenever this object requests an autosave.

DisplayChanged

#
event EventHandler<ObjectEventArgs> DisplayChanged
Raised whenever the display state of this object changes.

DocumentChanged

#
event EventHandler<ObjectDocumentEventArgs> DocumentChanged
Raised whenever this object becomes part of a different document.

Expired

#
Raised whenever the solution currently held by this object is expired.

InstanceIdChanged

#
event EventHandler<ObjectGuidEventArgs> InstanceIdChanged
Raised whenever the InstanceId of this object changes.

LayoutChanged

#
event EventHandler<ObjectEventArgs> LayoutChanged
Raised whenever the layout of this object changes. Layout invalidation triggers a canvas redraw.

NameChanged

#
Raised whenever the UserName of this object changes. This typically infers that the DisplayName also changes.

RelevanceChanged

#
event EventHandler<ObjectEventArgs> RelevanceChanged
Raised whenever the Auxiliary state of this object changes.

SelectedChanged

#
event EventHandler<ObjectEventArgs> SelectedChanged
Raised whenever the Selected state of this object changes.