"C# Grasshopper" Setting input as several data types

Hi everyone,

I’m trying to make my own component.
I want to connect several data types to one input.

I thought that Param.Input[i] is “Datatype” can be adopted to my problem but it doesn’t work.

Does anyone know how to do it?

Best
Shimpei

IGH_Param will never be the type IGH_Goo. The parameters in GH are generic classes GH_Param< T0> where T0 is GH_Goo< T1>, where T1 are the type of data (curve, number, arc, etc.).

We cannot make a hybrid parameter without creating our own parameter. But it’s not necessary, just use a Param_GenericObject, collects the data in SolveInstance with DA.GetData(…) using an object type, and then casts the data to the various types that you want to handle.

If you’re okay waiting with your type checking until the SolveInstance method, then you can use a Param_GenericObject. This will accept data of all types. Then your calls to DA.GetData() should always use IGH_Goo constraint and then you can check whether the data type provided was one of the types you can handle.

As @Dani_Abalde said, if you want this type filtering logic to already be in the parameter, then you’ll have to create your own GH_Param<T> type.