What does Addparameter first parameter?


#1

In the method addparameter (to add a custom variable type to component as input or out put) what is first parameter and what does it do?
it is IGH_param.
let’s say my custom type is a class named Library2.

protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
  pManager.AddParameter( param , "library", "FaL", "Load library",GH_ParamAccess.item);
}

#2

Is this tag ok or should I use Grasshopper developer or else?


(Steve Baer) #3

The tag is fine. @piac or @DavidRutten, can you help?


(Giulio Piacentino) #4

This call allows to register a parameter that is not one of the “custom” types, like string or brep.

If your custom type is called Library2 (and it must in a way or another implement IGH_Param - by for example deriving from GH_Param or GH_PersistentParam - so better call it Library2Param), you can instantiate it and pass it as an input into pManager.

Does that help?

Thanks

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#5

Hi again,
I am still on this thing(ofcourse not all the time) but well,
As I found out I needed to define my let’s say BaseStuff, Then define
StuffGHData:GH_Goo<“BaseStuff”>
and override some methods, then define
StuffGHParam: Gh_Param<“StuffGHData”>
override some other methods
Then use a new one of its instants in addparameter.
I did it all and no problem till here.Though in the solveInstance which I need to return a result I am wondering should it be BaseStuff type or StuffGHParam.
I can assign things to BaseStuff not to others but after building it in Grasshopper it turns red.
any idea?!
Thanks


(Giulio Piacentino) #6

Hi Kaveh

sorry I missed this topic as I did not receive any notifications about this.
You should investigate the exception that you are receiving. For example, try running the script in the debugger, or look at least at the baloon error message that turns the component red.

Thanks

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#7

Dear Guilio
I solved that problem.Now I can not load my component on GH.I explained in this post.


I 've posted files needed there also.I debugged it,but actually nothing happens.it is so silent with no error I can not find my mistake .may be you can have a look and help
Thanks,
Kaveh