Input parameters

Hi guys,

I have developed a component which needs 5 parameters, but 3 of them are optional. How could I control that? When I do the debug, I notice that every time, I need to give all of the five parameters. I have ask chatgpt, it doesn’t give me a solution.

Thank you.

Regards
Eric

this.Component.Params.Input[index].Optional = true;
You could also check if a value was assigned to a parameter, if not then It’s null.

Hi @smartunfold,

Nice.

Try doing something like this:

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
  var index = pManager.AddNumberParameter("Value", "V", "Some Value", GH_ParamAccess.item, 0);
  pManager[index].Optional = true;
  //...

– Dale