ComponentFunctionInfo

References
public abstract class ComponentFunctionInfo
Defines the base class for a function representing a component. This class is abstract.

Constructors

ComponentFunctionInfo

#
protected ComponentFunctionInfo(string name, string namespace, string description, IReadOnlyList<string> inputNames, IReadOnlyList<string> inputDescriptions, IReadOnlyList<string> inputTypeNames, IReadOnlyList<bool> inputsOptional, IReadOnlyList<string> outputNames, IReadOnlyList<string> outputDescriptions, IReadOnlyList<string> outputTypeNames, Guid componentGuid)
Instantiates a new instance of the function class. This is not meant for public consumption.
name (string)Name.
namespace (string)Namespace.
description (string)Description.
inputNames (IReadOnlyList<string>)Input parameter names.
inputDescriptions (IReadOnlyList<string>)Input parameter descriptions.
inputTypeNames (IReadOnlyList<string>)Input parameter type names.
inputsOptional (IReadOnlyList<bool>)Indications for optional inputs.
outputNames (IReadOnlyList<string>)Output names.
outputDescriptions (IReadOnlyList<string>)Output descriptions.
outputTypeNames (IReadOnlyList<string>)Output type names.
componentGuid (Guid)Component guid.

Properties

ComponentGuid

#Since v6.0
public Guid ComponentGuid { get; }
The unique identifier of the Grasshopper component. It is the original developer's responsibility to ensure that this ID is unique.

Delegate

#Since v6.0
public Delegate Delegate { get; }
Returns a delegate that can be directly invoked using a list of arguments. This flattens trees.

DelegateNoWarnings

#Since v6.0
public Delegate DelegateNoWarnings { get; }
Returns a delegate that can be directly invoked using a list of arguments. This flattens trees.

DelegateTree

#Since v6.0
public Delegate DelegateTree { get; }
Returns a delegate that can be directly invoked using a list of arguments. This considers trees and simplifies single-output components.

DelegateTreeNoWarnings

#Since v6.0
public Delegate DelegateTreeNoWarnings { get; }
Returns a delegate that can be directly invoked using a list of arguments. This considers trees and simplifies single-output components.

Description

#Since v6.0
public string Description { get; }
The function description.

FullName

#Since v6.0
public string FullName { get; }
Returns the name of the component prefixed by, if existing, the namespace.

FullScriptingName

#Since v6.0
public string FullScriptingName { get; }
Shows the full name of the component, including optional periods. Removes spaces and common operator signs.

InputDescriptions

#Since v6.0
public IReadOnlyList<string> InputDescriptions { get; }
The function input parameter descriptions.

InputNames

#Since v6.0
public IReadOnlyList<string> InputNames { get; }
The function input parameter names.

InputsOptional

#Since v6.0
public IReadOnlyList<bool> InputsOptional { get; }
Indications for each function input parameter whether it is optional.

InputTypeNames

#Since v6.0
public IReadOnlyList<string> InputTypeNames { get; }
The function input type names.

IsDefault

#Since v6.0
public bool IsDefault { get; }
Determines if the component is a default one.

Name

#Since v6.0
public string Name { get; }
The function name.

Namespace

#Since v6.0
public string Namespace { get; }
The function namespace.

OutputDescriptions

#Since v6.0
public IReadOnlyList<string> OutputDescriptions { get; }
Grasshopper returns several items in general. This property returns the output descriptions.

OutputNames

#Since v6.0
public IReadOnlyList<string> OutputNames { get; }
Grasshopper returns several items in general. This property returns the output names.

OutputTypeNames

#Since v6.0
public IReadOnlyList<string> OutputTypeNames { get; }
Grasshopper returns several items in general. This property returns the output type names.

Methods

Evaluate

#Since v6.0
public abstract object[] Evaluate(IEnumerable args, bool keepTree, out string[] warnings)
Evaluates the component with a set of arguments. There needs to be an argument for each input param, and each output param gives an entry in the output array.
Remarks: For component that store no state, this method is thread safe.
args (IEnumerable)The arguments list. Each item is assigned to each input param, in order.
keepTree (bool)A value indicating whether trees should be considered valid inputs, and should be returned. In this case, output variables are not simplified to common types.
warnings (out string[])A possible list of warnings, or null.
An array of objects, each representing an output result.

Invoke

#Since v7.0
public object[] Invoke(params object[] args)
Runs Evaluate(IEnumerable, bool, string[]) with keepTree equal to false, and raises an exception on the first warning.
args (params object[])Arguments. One for each component input.
Items.

InvokeKeepTree

#Since v7.0
public object[] InvokeKeepTree(params object[] args)
Runs Evaluate(IEnumerable, bool, string[]) with keepTree equal to true and raises an exception on the first warning.
args (params object[])Arguments. One for each component input.
Items.

InvokeKeepTreeSilenceWarnings

#Since v7.0
public object[] InvokeKeepTreeSilenceWarnings(params object[] args)
Runs Evaluate(IEnumerable, bool, string[]) with keepTree equal to true, and discards warnings (this is a dangerous operation!).
args (params object[])Arguments.
Array of items.

InvokeSilenceWarnings

#Since v7.0
public object[] InvokeSilenceWarnings(params object[] args)
Runs Evaluate(IEnumerable, bool, string[]) with keepTree equal to false, then simplifies output with SimplifyTreeOutput(object[], string[], bool) and discards warnings (this is a dangerous operation!).
args (params object[])Arguments. One for each component input.
Items.

ToString

#
public override string ToString()
Returns a string representing this function.
The namespace and the name.
Object.ToString