RegisterImputParam as item and list for different inputs in the same component

Hi all,

I would like to handle inputs on a custom component as the vast majority of GH default components, that is, to accept only one item or several items as a list on the same input. It seemed to work fine with just one point over a Point3d input set to list access, but I get errors with only one item of other types on list access.

I thought this would be easy to implement, but I couldn’t find some previous explanation that I could use, so I’m going around in circles and if anyone could help I would certainly appreciate it. Thanks in advance.

Most components do not place restrictions on how many input values there are. They will run multiple times if more items or more lists are provided.

If you wish to limit a specific input to only have single item (or a single list) then there is nothing in the api that will do this for you, you have to add that check yourself and also record an error message.

I may have misunderstood your problem, but have a look at this discussion: C# About GH_ParamAccess type

Hi, David,

I finally fixed it. I had to create a test component just for combining different input GH_ParamAccess with different output GH_ParamAccess, and passing single objects or lists through them.

Ultimately the error was due to a problem in my code. I had a clause to compare list lengths and I did not anticipate that DA.SetList would run several times, since I had one parameter registered as .item access.

Hopefully this can assist someone in the future.

1 Like