C# VisualStudio grasshopper make a pManager[1] option if pManager[0] is int 0 or int1

76 Views Asked by At

I hope will be enough clear in sharing my question.
C# in Visual Studio, I am trying to develop a grasshopper component.

I am interested in changing the behavior of the pManager[1], it needs to be required input when pMnager[0]= int 1 (as value) and to be optional when pManager[0]= int 0

In this way the component, after being compiled, will not ask for pManager[1] when the variable assigned to pManager[0] has a value equal to int 0;

pManager.AddIntegerParameter("A", "A", "description", GH_ParamAccess.item); //-->pManager[0]
pManager.AddTextParameter("B", "B", "Adescription", GH_ParamAccess.item); //-->pManager[1]

Thank you in advance!

A way to assign this behaviour to PManager[0].

pManager[1].Optional=true; (or false) but I can't get the value assigned to pManager[0] (something like this .GetValue() == 0; etc.

1

There are 1 best solutions below

0
Abba On

Ok seems I have solved it (or something like that):

directly in the solverInstance:

if (param0 == 0 )
  this.Params.Input[1].Optional = true;
else 
  this.Params.Input[1].Optional = false;