Change value of component parameter from C#

In C# it is possible to instantiate new components and add them to the Grasshopper canvas. Most likely this is done in the AddedToDocument() method of another custom component.

Values of input parameters can be changed by accessing the PersistentData attribute as shown in this example:

 

// disable wrap index
Param_Boolean param = (Param_Boolean)valueList.Params.Input[2];
param.PersistentData.Clear();
param.PersistentData.Append(new GH_Boolean(false));
param.OnObjectChanged(GH_ObjectEventType.PersistentData);