Grasshopper

algorithmic modeling for Rhino

How to avoid 'Input parameter ... failed to collect data' for empty input curve parameters

I have a custom component that can work on either 2 or 3 lists of curves as inputs, each of which is set up as a separate input parameter. However, it's not possible to set default values for Curve parameters, which forces the user to connect all three curve input parameters (even if only 2 are required) to avoid the message 'Input parameter ... failed to collect data'. How can I set up the curve inputs so that null values are valid? I'm currently registering these as curve parameters as below, and suspect the answer lies in using a different method for parameter registration.


 

protected override void RegisterInputParams(GH_Component.GH_InputParamManagerpManager)

{

pManager.Register_SurfaceParam(

"Reference Surface", "S", "Surface on which laths are to be generated", GH_ParamAccess.item);

pManager.Register_CurveParam(

"Surface curves 1", "Curves 1", "Set of curves across surface in first direction", GH_ParamAccess.list);

pManager.Register_CurveParam(

"Surface curves 2", "Curves 2", "Set of curves across surface in second direction", GH_ParamAccess.list);

pManager.Register_CurveParam(

"Surface Curves 3", "Curves 3", "Set of curves across surface in third direction", GH_ParamAccess.list);

pManager.Register_DoubleParam(

"Lath Offsets 1", "LO1", "Offset from surface to centreline of first layer", 0.0, GH_ParamAccess.item);

pManager.Register_DoubleParam(

"Lath Offsets 2", "LO2", "Offset from surface to centreline of second layer", 0.0, GH_ParamAccess.item);

pManager.Register_DoubleParam(

"Lath Offsets 3", "LO3", "Offset from surface to centreline of third layer", 0.0, GH_ParamAccess.item);

pManager.Register_IntegerParam(

"Seed Value (0, 1, 2)", "Seed", "Seed value for weave offsets (0 for no weave, 1 or 2 for weave)",0, GH_ParamAccess.item);

}

 

Thanks!

Alex

 

 

Views: 6705

Replies to This Discussion

pManager[3].Optional = true;

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Has this changed? Or is there anything else I need to do to set up a default value? I'm trying to make the boolean parameter optional below, but it's still giving me the 'Input parameter ... failed to collect data' error.

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddLineParameter("Lines", "L", "webAxis", GH_ParamAccess.list);
pManager.AddBooleanParameter("FirstConnection", "B", "flip first connection", GH_ParamAccess.item);
pManager[1].Optional = true;
}

Weird.. I just added a second optional parameter to this component, and now both of them work!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service