public sealed class IGH_Component : IGH_DocumentObject
A wrapper around an instance of the IGH_Component interface as defined in Grasshopper 1. This class exposes various common properties of GH1 components.

Constructors

IGH_Component

#
Create a new wrapper for a Grasshopper 1.0 component.
public IGH_Component(
igh_componentInstance
An instance of a type which implements the Grasshopper.Kernel.IGH_Component interface as defined in Grasshopper 1.
)

Properties

Activity

Gets the object activity of the underlying GH1 object, assuming this instance wraps an IGH_ActiveObject.
public ObjectActivity Activity { get; }
inherited fromIGH_DocumentObject

Bounds

Gets the bounds as per the attributes.
public RectangleF Bounds { get; }
inherited fromIGH_DocumentObject

ComponentId

Gets the type identifier of the underlying object.
public Guid ComponentId { get; }
inherited fromIGH_DocumentObject

Display

Gets the object preview of the underlying GH1 object, assuming this instance wraps an IGH_PreviewObject.
public ObjectDisplay Display { get; }
inherited fromIGH_DocumentObject

Icon

Gets the icon of the underlying object. Note that is is a relatively expensive process, as the icon needs to be converted from the GDI bitmap format into the ETO bitmap format.
public Bitmap Icon { get; }
inherited fromIGH_DocumentObject

Info

Gets the tooltip info of the underlying object.
public string Info { get; }
inherited fromIGH_DocumentObject

InputCount

#
Gets the number of input parameters, assuming this instance wraps an IGH_Component.
public int InputCount { get; }

InstanceId

Gets the instance identifier the underlying object.
public Guid InstanceId { get; }
inherited fromIGH_DocumentObject

IsComponent

#
public override bool IsComponent { get; }

IsParameter

Gets whether this object wraps a Grasshopper 1.0 parameter.
public virtual bool IsParameter { get; }
inherited fromIGH_DocumentObject

Name

Gets the name of the underlying object.
public string Name { get; }
inherited fromIGH_DocumentObject

OutletPoint

Gets the point wires leave this object from, as per the Grasshopper 1 attributes.
public PointF OutletPoint { get; }
inherited fromIGH_DocumentObject

OutputCount

#
Gets the number of output parameters, assuming this instance wraps an IGH_Param.
public int OutputCount { get; }

UnderlyingObject

Gets the hosted object.
public dynamic UnderlyingObject { get; }
inherited fromIGH_DocumentObject

UserName

Gets the nickname of the underlying object. In Grasshopper 2, this is called the UserName.
public string UserName { get; }
inherited fromIGH_DocumentObject

Methods

GetValue

Read a boolean option which Grasshopper 1 kept as a named value on the object.
public bool GetValue(
name,
Name of the value.
fallback
Value to return when the object has no such entry.
)
inherited fromIGH_DocumentObject

HideModularOutput

#
Hide the output at the given index if the component is modular and the output is visible.
public static void HideModularOutput(
component,
Component owning the output.
index
Index of the output.
)

Input

#
Gets the Nth input parameter, assuming this instance wraps an IGH_Component. If the index is out of range, null will be returned.
public IGH_Param Input(
index
)

Migrate

Try and migrate this Grasshopper 1.0 object to one or more Grasshopper 2.0 objects. First a dedicated migrator will be attempted, and if that fails an interop wrapper object will be created. Default attributes will be created and the migrated object will be positioned and sized so that it best matches the source. If everything fails, nothing will happen and an empty array will be returned.
public IDocumentObject[] Migrate()
inherited fromIGH_DocumentObject

Output

#
Gets the Nth output parameter, assuming this instance wraps an IGH_Component. If the index is out of range, null will be returned.
public IGH_Param Output(
index
)

ShowModularInput

#
Show the input at the given index if the component is modular and the input is hidden.
public static void ShowModularInput(
component,
Component owning the input.
index
Index of the input.
)

ShowModularOutput

#
Show the output at the given index if the component is modular and the output is hidden.
public static void ShowModularOutput(
component,
Component owning the output.
index
Index of the output.
)

TransferInputs

#
Transfer input parameter properties from this Grasshopper 1 component to a supplied Grasshopper 2 component.
public void TransferInputs(
component,
Component whose inputs to affect.
params (int gh1, int gh2)[]
pairs
List of input pairs.
)

TransferInstanceId

Copy the instance ID of the Grasshopper 1 parameter into the CustomValues of the grasshopper 2 parameter. This is typically only used to recreate wires between parameters.
public void TransferInstanceId(
docObject
)
inherited fromIGH_DocumentObject

TransferObjectName

Copy the nickname of this object into the UserName of the given object.
public void TransferObjectName(
docObject
)
inherited fromIGH_DocumentObject

TransferObjectState

Copy the preview and enabled states from the underlying object into the GH2 object,
public void TransferObjectState(
docObject
)
inherited fromIGH_DocumentObject

TransferOutputs

#
Transfer output parameter properties from this Grasshopper 1 component to a supplied Grasshopper 2 component.
public void TransferOutputs(
component,
Component whose outputs to affect.
params (int gh1, int gh2)[]
pairs
List of output pairs.
)