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
#public RectangleF AttributeBounds { get; }
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.
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
#public RectangleF PivotBounds { get; }
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.
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
#public int Absorb(ObjectList other, bool reinstateInputs, bool reinstateOutputs, ActionList actions = null)
Absorb all objects from another ObjectList. This eventually empties the other list completely.
Parameters:
| other (ObjectList) | List of objects to absorb. |
| reinstateInputs (bool) | 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 (bool) | 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 (ActionList = 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.
Parameters:
| obj (IDocumentObject) | Object to add. |
| idMap (Dictionary<Guid, Guid>) | Id map for keeping track of instance id changes. |
Returns: True on success, false on failure.
Add
#Add an object to this collection and change the instance IDs.
Parameters:
| obj (IDocumentObject) | Object to add. |
| location (PointF) | Hint for centre of object. |
| idMap (Dictionary<Guid, Guid>) | Id map for keeping track of instance id changes. |
Returns: True on success, false on failure.
Add
#Add an object to this collection.
Parameters:
| obj (IDocumentObject) | Object to add. |
| location (PointF) | Hint for centre of object. |
Returns: True on success, false on failure.
Add
#Add an object to this collection.
Parameters:
| obj (IDocumentObject) | Object to add. |
Returns: True on success, false on failure.
AddGlobalPin
#Add a document-level pin.
Parameters:
| pin (IPin) | Pin to add. Pin must have no inputs, no outputs, non-empty persistent data and no pre-existing document affiliation. |
Returns: True if pin was successfully added.
ApplyIdMap
#Apply a custom InstanceID transform to this document.
Parameters:
| map (Dictionary<Guid, Guid>) | 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.
Parameters:
| obj (IDocumentObject) | |
| map (Dictionary<Guid, Guid>) |
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.
Parameters:
| dic (Dictionary<MetaName, HashSet<string>>) | Dictionary to compact. |
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.
Parameters:
| objectId (Guid) |
Contains
#Test whether an instanceId is defined in this collection.
Parameters:
| instanceId (Guid) | InstanceId to search for. |
| level (ObjectLevel) | Object levels to include in search. |
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.
Find
#Find the object with the given instanceID.
Parameters:
| instanceId (Guid) | Instance id to look for. |
Returns: Object or null.
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.
Parameters:
| point (PointF) | Search point. |
Returns: Parameter with an inlet closest to the given point.
FindByInletOrOutlet
#public (IParameter parameter, bool inletWithinRange, bool outletWithinRange) FindByInletOrOutlet(PointF point)
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.
Parameters:
| point (PointF) | 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.
Parameters:
| point (PointF) | Search point. |
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.
FindComponent
#Find the component with the given instanceID.
Parameters:
| instanceId (Guid) | Instance id to look for. |
Returns: Component or null.
FindGroup
#Find the group with the given instanceID.
Parameters:
| instanceId (Guid) | Instance id to look for. |
Returns: Group or null.
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.
FindParameter
#Find the parameter with the given instanceID.
Parameters:
| instanceId (Guid) | Instance id to look for. |
Returns: Parameter or null.
IsWireSelected
#Gets whether a specific connection is considered selected.
IsWireSelected
#Gets whether a specific connection is considered selected.
Parameters:
| wire (WireEnds) | Wire description. |
Returns: True if the wire between them (if any) is considered selected.
MetaDataSummaries
#Get the meta data summaries of the current object set.
Parameters:
| token (CancellationToken) |
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
#public IEnumerable<IDocumentObject> ObjectsByDrawOrder(bool includeForeground, bool includeBackground)
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.
Remove
#Remove an object from this collection.
Parameters:
| objectId (Guid) | InstanceId of object to remove. |
Returns: True on success, false on failure.
Remove
#Remove an object from this collection.
Parameters:
| obj (IDocumentObject) | Object to remove. |
Returns: True on success, false on failure.
RepairPins
#Perform a set of pin/cushion repair methods.
Parameters:
| repairMethods (PinRepair = PinRepair.Default) |
Returns: Array of repair actions taken.
ResolvePick
#public SelectionResult ResolvePick(PointF point, bool includeGrips, bool includeForeground, bool includeBackground, bool recursive)
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.
Parameters:
| point (PointF) | Pick location. |
| includeGrips (bool) | If true, parameter inlets and outlets will be considered. |
| includeForeground (bool) | If true, objects drawn on top of wires will be considered. |
| includeBackground (bool) | If true, objects drawn undernath wires will be considered. I.e. groups. |
| recursive (bool) | 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.
Parameters:
| parameter (IParameter) | Parameter to start from. |
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.
Parameters:
| parameter (IParameter) | Parameter to start from. |
SelectWire
#Select a specific wire.
ShootRay
#Shoot a ray through the display geometry of all objects and see which one is hit.
Parameters:
| ray (DragRay) | |
| token (CancellationToken) | |
| hit (out DragHit) |
Returns: True if ray hit something.
Store
#Serialization method for filtered objects.
Parameters:
| writer (IWriter) | Archive writer. |
| filter (Func<IDocumentObject, bool>) | Filter predicate. |
Store
#Serialization method for a custom list of objects.
Parameters:
| writer (IWriter) | |
| objects (IEnumerable<IDocumentObject>) |
WindowSelect
#public SelectionResult WindowSelect(WindowSelection window, SelectionMode mode, bool considerForeground = true, bool considerBackground = true, bool considerWires = true)
Perform a window selection on all objects and wires.
Parameters:
| window (WindowSelection) | |
| mode (SelectionMode) | |
| considerForeground (bool = true) | |
| considerBackground (bool = true) | |
| considerWires (bool = 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.