GH_Variant

References
public class GH_Variant
Variant data used in Grasshopper Expressions.

Constructors

GH_Variant

#
public GH_Variant()
Create a new Null variant.

GH_Variant

#
public GH_Variant(bool value)
Create a new Bool variant.
value (bool)Value of Variant.

GH_Variant

#
public GH_Variant(Complex value)
Create a new Complex variant.
value (Complex)Value of Variant.

GH_Variant

#
public GH_Variant(double value)
Create a new Double variant.
value (double)Value of Variant.

GH_Variant

#
public GH_Variant(GH_Variant other)
Duplicate a Variant.
other (GH_Variant)Variant to duplicate

GH_Variant

#
public GH_Variant(int value)
Create a new Integer variant.
value (int)Value of Variant.

GH_Variant

#
public GH_Variant(Plane value)
Create a new Plane variant.
value (Plane)Value of Variant.

GH_Variant

#
public GH_Variant(Point3d value)
Create a new Point variant.
value (Point3d)Value of Variant.

GH_Variant

#
public GH_Variant(string value)
Create a new String variant.
value (string)Value of Variant.

GH_Variant

#
public GH_Variant(Vector3d value)
Create a new Point variant.
value (Vector3d)Value of Variant.

Properties

_Bool

#
public bool _Bool { get; }
Gets the contents of this Variant as a bool.

_Complex

#
public Complex _Complex { get; }
Gets the contents of this Variant as a complex number.

_Double

#
public double _Double { get; }
Gets the contents of this Variant as a double. If the Variant is of type Integer this cast will also work.

_Int

#
public int _Int { get; }
Gets the contents of this Variant as an integer.

_Plane

#
public Plane _Plane { get; }
Gets the contents of this Variant as a Plane.

_Point

#
public Point3d _Point { get; }
Gets the contents of this Variant as a Point.

_String

#
public string _String { get; }
Gets the contents of this Variant as a String. This function will work for all Variant types.

_Vector

#
public Vector3d _Vector { get; }
Gets the contents of this Variant as a Vector.

IsNumeric

#
public bool IsNumeric { get; }
Gets a value indicating whether or not the Variant is a numeric type. Only Doubles and Integers are considered to be Numeric.

Type

#
public GH_VariantType Type { get; }
Gets the Type of this Variant.

Methods

Data<T>

#
public T Data<T>()
Perform a straight cast of the data inside this Variant.
The value inside this Variant cast to T.

Duplicate

#
public GH_Variant Duplicate()
Duplicate this Variant. If the type of this Variant is [unknown] the contents are not guaranteed to be duplicated.

Evaluate

#
public bool Evaluate()
If this variant represents a string, this function will attempt to evaluate that string and replace the data inside this variant.
True if the string was evaluated, false if otherwise.

ToGoo

#
public IGH_Goo ToGoo()
Attempt to convert a Variant to a Grasshopper IGH_Goo type.
An instance of a class implementing IGH_Goo or null.

ToString

#
public override string ToString()
Object.ToString