I am developing a custom component in C# VS, the behavior of this component will depend on options that the user provide. For now I have a number of inputs that are common to all options and others that will be created dynamically based on the option the user provide.
For now I manage to update the parameters on the component but I cannot connect anything to it and read values. Here is a snippet of the code Inside SolveInstance:
switch (BType)
{
case "5":
for (int i = 4; i < this.Params.Input.Count(); i++)
{ this.Params.UnregisterInputParameter(this.Params.Input[i]); }
int a = this.Params.Input.Count;
Grasshopper.Kernel.Parameters.Param_Number param3 = new Grasshopper.Kernel.Parameters.Param_Number();
this.Params.RegisterInputParam(param3);
this.Params.Input[4].Name = "Point Contact Properties";
this.Params.Input[4].NickName = "Point Contact";
this.Params.Input[4].Access = GH_ParamAccess.list;
this.Params.Input[4].Optional = true;
break;
case "6":
for (int i = 4; i < this.Params.Input.Count(); i++)
{ this.Params.UnregisterInputParameter(this.Params.Input[i]); }
Grasshopper.Kernel.Parameters.Param_Number param1 = new Grasshopper.Kernel.Parameters.Param_Number();
this.Params.RegisterInputParam(param1);
this.Params.Input[4].Name = "Beam Properties";
this.Params.Input[4].NickName = "Beam";
this.Params.Input[4].Access = GH_ParamAccess.list;
this.Params.Input[4].Optional = true;
this.Params.OnParametersChanged();
a = this.Params.Input.Count;
ExpireSolution(true);
DA.GetDataList(4, MaterialProperty);
break;
case "9":
for (int i = 4; i < this.Params.Input.Count(); i++)
{ this.Params.UnregisterInputParameter(this.Params.Input[i]); }
Grasshopper.Kernel.Parameters.Param_Number param2 = new Grasshopper.Kernel.Parameters.Param_Number();
this.Params.RegisterInputParam(param2);
this.Params.Input[4].Name = "Connection Properties";
this.Params.Input[4].NickName = "Connection";
this.Params.Input[4].Access = GH_ParamAccess.list;
this.Params.Input[4].Optional = true;
a = this.Params.Input.Count;
this.Params.OnParametersChanged();
ExpireSolution(true);
DA.GetDataList(4, MaterialProperty);
break;
}
Can anyone please tell me what I am doing wrong here or if I am missing something!
Thanks,