Click or drag to resize

IGH_TaskCapableComponent Interface

GH_Component that can choose to support the use of Tasks to compute solutions When UseTasks returns true, the component has it's SolveInstance enumeration called twice. The first pass (InPreSolve=True) is intended solely for collecting data and starting calculation tasks. The second pass (InPreSolve=False) takes results or the tasks and sets the output.

Namespace:  Grasshopper.Kernel
Assembly:  Grasshopper (in Grasshopper.dll)
public interface IGH_TaskCapableComponent : IGH_Component

The IGH_TaskCapableComponent type exposes the following members.

Public propertyInConstructor
Gets the constructor flag for this instance. If InConstructor = True, it means the component is still registering parameters and the layout is not yet complete.
(Inherited from IGH_Component.)
Public propertyInPreSolve
Is set to True by the framework right before a "use tasks" pass is made on SolveIntance calls. When True, SolveInstance should be using Tasks to start calculations on input data. When False, SolveInstance should be setting the output data by either using the result of a task or directly computing the results.
Public propertyIsValidMasterParameterIndex
Gets whether the MasterParameterIndex property identifies a valid parameter.
(Inherited from IGH_Component.)
Public propertyMasterParameterIndex
Gets or sets the master parameter index override. Negative indices or indices larger than or equal to the input parameter count will be ignored and regular master parameter detection will kick in.
(Inherited from IGH_Component.)
Public propertyMessage
Gets or sets a custom message to be displayed underneath the component.
(Inherited from IGH_Component.)
Public propertyParams
Gets the Params object that managed input and output parameters.
(Inherited from IGH_Component.)
Public propertyRunCount
Gets a value indicating how many times the SolveInstance method was called on this component during the last solution. This property will return -1 if no valid runcount is available.
(Inherited from IGH_Component.)
Public propertyUseTasks
Returns True if the component is set to support tasks. Components can have this feature turned on/off. Note that even if UseTasks returns True, there is a chance that a multipass task based solution may not be invoked depending on if multiple calls need to be made during enumeration. You must pay attention to the value of InPreSolve during SolveInstance. The set version of this property can be called by the framework if we want to provide a technique to globally turn on/off task support for all components in a definition.
Public methodRequestTaskCancellation
Called by the framework when solving has been interrupted and tasks do not need to complete.
See Also