IGH_DocumentObject

References
public class IGH_DocumentObject
A wrapper around a dynamic Grasshopper 1.0 IGH_DocumentObject which exposes a bunch of common component and parameter properties in a strongly-typed way.

Constructors

IGH_DocumentObject

#
public IGH_DocumentObject(object underlyingObject)
Create a new wrapper for a Grasshopper 1.0 document object.
underlyingObject (object)An instance of a type which implements the Grasshopper.Kernel.IGH_DocumentObject 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.

Bounds

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

ComponentId

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

Display

#
public ObjectDisplay Display { get; }
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.

Info

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

InstanceId

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

IsComponent

#
public virtual bool IsComponent { get; }
Gets whether this object wraps a Grasshopper 1.0 component.

IsParameter

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

Name

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

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

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

Methods

GetValue

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

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.

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.
docObject (IDocumentObject)

TransferObjectName

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

TransferObjectState

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