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
Properties
Activity
Gets the object activity of the underlying GH1 object, assuming this instance wraps an IGH_ActiveObject.
Bounds
public RectangleF Bounds { get; }
Gets the bounds as per the attributes.
Display
Gets the object preview of the underlying GH1 object, assuming this instance wraps an IGH_PreviewObject.
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.
IsParameter
Gets whether this object wraps a Grasshopper 1.0 parameter.
OutletPoint
public PointF OutletPoint { get; }
Gets the point wires leave this object from, as per the Grasshopper 1 attributes.
UnderlyingObject
public dynamic UnderlyingObject { get; }
Gets the hosted object.
UserName
Gets the nickname of the underlying object. In Grasshopper 2, this is called the UserName.
Methods
GetValue
Read a boolean option which Grasshopper 1 kept as a named value on the object.
HideModularOutput
#Hide the output at the given index if the component is modular and the output is visible.
Input
#Gets the Nth input parameter, assuming this instance wraps an IGH_Component. If the index is out of range, null will be returned.
Parameters:
| index (int) |
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.
Output
#Gets the Nth output parameter, assuming this instance wraps an IGH_Component. If the index is out of range, null will be returned.
Parameters:
| index (int) |
ShowModularInput
#Show the input at the given index if the component is modular and the input is hidden.
ShowModularOutput
#Show the output at the given index if the component is modular and the output is hidden.
TransferInputs
#Transfer input parameter properties from this Grasshopper 1 component to a supplied Grasshopper 2 component.
Parameters:
| component (Component) | Component whose inputs to affect. |
| pairs (params (int gh1, int gh2)[]) | 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.
Parameters:
| docObject (IDocumentObject) |
TransferObjectName
Copy the nickname of this object into the UserName of the given object.
Parameters:
| docObject (IDocumentObject) |
TransferObjectState
Copy the preview and enabled states from the underlying object into the GH2 object,
Parameters:
| docObject (IDocumentObject) |
TransferOutputs
#Transfer output parameter properties from this Grasshopper 1 component to a supplied Grasshopper 2 component.
Parameters:
| component (Component) | Component whose outputs to affect. |
| pairs (params (int gh1, int gh2)[]) | List of output pairs. |