private void dynamicParameters(int inputIndex){
//we first check if the Dynamic parameters are already added
//if they are added, better get out of this method
List<IGH_Param> inputParams = Params.Input.
FindAll(param => param.Name.Contains(“Dyna”));
if (inputParams.Count > 0 && inputIndex == 2) return;
else
{
}
}
public bool RegisterInputParam(
IGH_Param new_param
)
Grasshopper.Kernel.Parameters.Param_Number dyna1Param =
new Grasshopper.Kernel.Parameters.Param_Number();
dyna1Param.Optional = true;
dyna1Param.Name = “Dyna-1”;
dyna1Param.NickName = “Dyna-1”;
dyna1Param.Access = GH_ParamAccess.item;
As you can see, the attributes that we are setting on the parameter are pretty much self-explanatory. Once everything is set, we want to Register this parameter with the Parameter Manager Object
public GH_ComponentParamServer Params { get; }
Params.RegisterInputParam(dyna1Param);
Params.UnregisterInputParameter(param);
//first see if have the Dynamically added parameters. If we have then only
//loop through the remove those parameters.
List<IGH_Param> inputParams = Params.Input.
FindAll(param => param.Name.Contains(“Dyna”));
if (inputParams.Count >0 && inputIndex == 1) {
foreach (var param in inputParams)
{
Params.UnregisterInputParameter(param);
}
}