Properties
ActiveObjects
#Gets a foreach enumerator for all top-level objects which are potentially active during solutions. This enumerator only considers objects whose phase is set to something other than ObjectPhase.Irrelevant.
AllWires
#Enumerates over all wires in this document. This includes dangling wires whose source or target parameter may no longer exist.
AttributeBounds
#Gets the strict bounds of all the top-level attributes in this document. Note that the wires which connect outputs and inputs may exceed these bounds.
public RectangleF AttributeBounds { get; }
Connectivity
#Gets the connectivity of this document. This represents an immutable snapshot of all active objects and groups and their connections.
Count
#Gets the number of objects stored in this collection. Only primary objects are included in the count.
ExpiredObjects
#Gets a foreach enumerator for all top-level objects which are either expired or aborted.
PivotBounds
#Gets the strict bounds of all the top-level attribute pivots in this document. This does typically not require a layout pass and as such is a quicker and more reliable, albeit less accurate way to measure the extends of the objects.
public RectangleF PivotBounds { get; }
PrimaryAndSecondary
#Gets a foreach enumerator for all primary and subsidiary objects. This will include those objects which are part of other objects, such as input or output parameters.
SelectedWireCount
#Gets the number of selected wires. This count may include wires which are no longer drawn, as the list is only updated in response to UI events, not programmatic changes to the graph.
Methods
Absorb
#Absorb all objects from another ObjectList. This eventually empties the other list completely.
public int Absorb()
other,
List of objects to absorb.
reinstateInputs,
If true, dangling connections from the objects in the 'other' list to sources in this collection will be reinstated. If false, those connections will be cleaned up.
reinstateOutputs,
If true, dangling connections from the objects in the 'other' list to targets in this collection will be reinstated. If false, those connections will be cleaned up.
actions = null
Undo action list to populate. No undo record will be added by this method.
Returns: Number of objects transferred.
Add
#Add an object to this collection and change its instance IDs.
Returns: True on success, false on failure.
Add
#Add an object to this collection and change the instance IDs.
public bool Add()
obj,
Object to add.
PointF
location,
Hint for centre of object.
idMap
Id map for keeping track of instance id changes.
Returns: True on success, false on failure.
ApplyIdMap
#Apply a custom InstanceID transform to this document.
public void ApplyIdMap()
map
A dictionary containing new object instance IDs based on old instanceIDs. It's hard to imagine you needing this function, but it's here just in case.
ApplyIdMap
#Inform an object about changes to InstanceIds. You should always use this method to apply id mappings as it handles a bunch of hard-coded cases.
ChangeAllIds
#Mutate the instanceIds of all the objects in this document. This must be done if the objects are about to be merged into another document which may contain objects with the same IDs. The regular methods in Grasshopper (paste, merge, etc.) already do this. Never change the InstanceIDs yourself, only ever use this method to do so.
ClearDisplayCaches
#Clear the display caches. Caches should be updated or cleared automatically when modifying the Forwards via standard methods.
CompactMetadataDictionary
#Try and compact the meta data summary by merging the value hashsets into shorter descriptions.
public void CompactMetadataDictionary()
Returns: Number of entries that were compacted.
ContainingGroups
#Iterate over all groups which (directly) contain the given instance ID. This enumerator will not return groups which contain groups which contain the object.
Contains
#Test whether an instanceId is defined in this collection.
Returns: True if the instanceId is already defined in this collection.
DeselectWire
#Deselect a specific wire.
DisplayableObjects
#Gets all display capable objects in this document, regardless of states and properties. *If* an object can draw displays, it will be included in this collection. This array is cached, calling this method repeatedly should be fine from a performance point of view.
FindByInlet
#Find the parameter with the inlet closest to the search point. This method will find an inlet even if it is occluded by another object.
Returns: Parameter with an inlet closest to the given point.
FindByInletOrOutlet
#Find the parameter with an inlet or outlet closest to the search point. This method wil not return inlets or outlets which are occluded by other objects.
public (IParameter parameter, bool inletWithinRange, bool outletWithinRange) FindByInletOrOutlet()
PointF
point
Search point.
Returns: Parameter search results or null.
FindByOutlet
#Find the parameter with the outlet closest to the search point. This method will find an outlet even if it is occluded by another object.
Returns: Parameter with an outlet closest to the given point.
FindBySearch
#Find the objects that match the search string. UNFINISHED METHOD. I need to figure out what fields to search and what the notation might look like.
Returns: An array of objects that match the search string best.
FindNear<T>
#Find all objects at the given location, sorted from most relevant to least relevant. Objects in front of other objects are more relevant, and objects closer to the locus are also more relevant.
Returns: Array of objects at or near the locus.
IsWireSelected
#Gets whether a specific connection is considered selected.
Returns: True if the wire between them (if any) is considered selected.
IsWireSelected
#Gets whether a specific connection is considered selected.
Returns: True if the wire between them (if any) is considered selected.
MetaNames
#Enumerate over all meta names used in this document. Note that meta names may change during every solution. This method will iterate over all objects regardless of whether new solutions are happening while it's busy.
MetaNamesAndValues
#Find all meta names and associated values. Note that meta names may change during every solution. This method will iterate over all objects regardless of whether new solutions are happening while it's busy.
ObjectsByDrawOrder
#Enumerate over all objects in the (reverse) order in which they are drawn. That is, the first object returned is the topmost one, and so on. The draw order is a fairly complicated one since the introduction of Pins, which can be attached to objects with different draw-order and even different draw-layer.
public IEnumerable<IDocumentObject> ObjectsByDrawOrder()
includeForeground,
If true, objects drawn above wires are iterated over.
includeBackground
If true, objects drawn below wires are iterated over.
ResolvePick
#Resolve the target of a pick operation on all the objects in this document. Note that this will not include any wires, as the shapes of wires aren't known to the document. Only the Canvas which draws the document knows where and how wires are drawn so if you want a pick which includes the wires, you must use the Canvas.ResolvePick() method instead.
public SelectionResult ResolvePick()
PointF
point,
Pick location.
includeGrips,
If true, parameter inlets and outlets will be considered.
includeForeground,
If true, objects drawn on top of wires will be considered.
includeBackground,
If true, objects drawn undernath wires will be considered. I.e. groups.
recursive
If true, subobjects are considered within top-level objects.
Returns: Picking result.
SearchDownstream
#Iterate over all objects that are downstream from a parameter. This includes the component if the parameter is an input, it will include all target parameters, their components, the outputs of those components, and so on. This a depth-first search without duplicates.
SearchUpstream
#Iterate over all objects that are upstream from a parameter. This includes the component if the parameter is an output, it will include all source parameters, their components, the inputs of those components, and so on. This a depth-first search without duplicates.
SelectWire
#Select a specific wire.
ShootRay
#Shoot a ray through the display geometry of all objects and see which one is hit.
Returns: True if ray hit something.
WindowSelect
#Perform a window selection on all objects and wires.
public SelectionResult WindowSelect()
window,
mode,
considerForeground = true,
considerBackground = true,
considerWires = true
Returns: Number of modified selection states.
Events
ObjectDisplayChanged
#Raised whenever the display state of one of the objects in this collection expires.
ObjectEnabledChanged
#Raised whenever one of the objects in this collection changes its enabled state.
ObjectInstanceIdChanged
#Raised whenever the instance ID of one of theobjects in this collection expires.
ObjectRelevanceChanged
#Raised whenever one of the objects in this collection changes its auxiliary state.
ObjectSelectionChanged
#Raised whenever one of the objects in this collection changes its selected state.