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

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

Properties

Activity

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

Bounds

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

ComponentId

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

Display

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

Icon

public Bitmap Icon { get; }
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.
inherited fromIGH_DocumentObject

Info

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

InputCount

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

InstanceId

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

IsComponent

#
public override bool IsComponent { get; }

IsParameter

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

Name

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

OutletPoint

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

OutputCount

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

UnderlyingObject

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

UserName

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

Methods

GetValue

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

HideModularOutput

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

Input

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

Migrate

public IDocumentObject[] 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.
inherited fromIGH_DocumentObject

Output

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

ShowModularInput

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

ShowModularOutput

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

TransferInputs

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

TransferInstanceId

public void TransferInstanceId(IDocumentObject docObject)
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.
inherited fromIGH_DocumentObject
docObject (IDocumentObject)

TransferObjectName

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

TransferObjectState

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

TransferOutputs

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