algorithmic modeling for Rhino
Hi, I would like to add/remove parameters in a C# custom component via a custom button or through the context menu of the component (not the IGH_VariableParameterComponent interface (+)(-)).
I tried the following however I cannot connect any wires to parameters that are added like below. Could someone tell me what I am missing?
Thanks a bunch in advance.
public void AddParam(object sender, EventArgs e)
{
Param_GenericObject param = new Param_GenericObject();
param.Name = "L"+(ParamsLocal.Count + 1);
param.NickName = param.Name;
param.Description = "Param" + (Params.Input.Count + 2);
param.Access = GH_ParamAccess.item;if (Params.RegisterInputParam(param))
{
ParamsLocal.Add(param);
ExpireSolution(true);
}}public void RemoveParam(object sender, EventArgs e)
{
if (ParamsLocal.Count < 1) return;Param_GenericObject removeMe = ParamsLocal[ParamsLocal.Count - 1];
if(Params.UnregisterInputParameter(removeMe)){
ParamsLocal.Remove(removeMe);
ExpireSolution(true);
}}
Tags:
Hi Tim
may I ask if you really need to take this road? It is a very bumpy road, to be honest. It's also highly likely that it will take quite a bit of work to maintain it.
What are you trying to do with the variable input?
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Giulio,
thanks a lot for your reply.
Here is what I want to do:
A component that creates a construction consisting out of layers. As first input I would like to have a string to name the construction.
The second input should be the first layer.
If the construction has more layers I would like to have a btn that allows to add more layer inputs.
I implemented this component taking a string and a list of layers before. However many people found the control over the ordering of the layers confusing.
Id be very happy to hear if you have a better idea. Thanks a bunch for your help in advance.
Tim
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by