Grasshopper

algorithmic modeling for Rhino

hello, 

I am trying to understand GH_ParamAccess Enumeration

it says " Enumerates the types of access that parameters support", but I see no diferences between the 2 lines below. When I run my component, all data inputs work(list, simple item, tree). I thought it was a way to set input data type, like only list input are accepted, or only simple item, .../

Can someone help on this?

 


pManager.Register_PointParam("Point", "Point", "Point");

 

pManager.Register_PointParam("Point", "Point", "Point", Grasshopper.Kernel.GH_ParamAccess.list);

Views: 827

Replies to This Discussion

Hi raf,

 

you are correct, depending on the param access type you pick you are only allowed to use DA.GetData, DA.GetDataList or DA.GetDataTree. You should get errors when you use the wrong method. However, the Access flag is serialized in the ghx file, so if you change the code, then open an old file which defines different data access flags you'll run into trouble. Basically, you're never supposed to make changes to the input and output parameters of a component when that component has potentially been serialized by someone.

 

I don't know why you're not getting error messages, maybe you're not loading the gha file you think you're loading?

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

hello david,
actually that's right I have an error message. I was a bit confused .. I was thinking that using GH_ParamAccess Enumeration will also return a kind of popup message when wrong "type" of inputs are input to my component, like "sorry you are trying to input a list but you can only input a simple item...;)"... the error message is comming when the component start to compute... anyway this was just for me to get a bit more familiar with GH SDK..not a big deal..
thx

Ah, then no. The access does not place restrictions on what sort of data you can supply, only how the component can internally access the data. And of course it affects how the component 'iterates' over all data in all input parameters.

 

If you have only one input param and its access is set to item, then SolveInstance() will be called once for each element in the data. If the access is set to list, then SolveInstance() will only be called once for every list of items in the data.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

 

ok I understand now..it's like the c#/ vb components where you can set the data access by using right click...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service