/*******************************************/ public static bool CastToGoo(object value, ref IGH_QuickCast target) { try { if (value is bool) { target = new GH_Boolean((bool)value); } else if (value is Color) { target = new GH_Colour((Color)value); } else if (value is Complex) { target = new GH_ComplexNumber((Complex)value); } else if (value is int) { target = new GH_Integer((int)value); } else if (value is Interval) { target = new GH_Interval((Interval)value); } else if (value is Matrix) { target = new GH_Matrix((Matrix)value); } else if (value is double || value is float) { target = new GH_Number((double)value); } else if (value is Point3d) { target = new GH_Point((Point3d)value); } else if (value is string) { target = new GH_String(value.ToString()); } else if (value is Vector3d) { target = new GH_Vector((Vector3d)value); } return(true); } catch { return(false); } }
/*******************************************/ public static bool CastToGoo(object value, ref GH_ComplexNumber target) { return(GH_Convert.ToGHComplexNumber(value, GH_Conversion.Both, ref target)); }