GH_Structure access on Custom Component - Grasshopper2024-03-29T10:01:00Zhttps://www.grasshopper3d.com/forum/topics/gh-structure-access-on-custom-component?commentId=2985220%3AComment%3A1775093&feed=yes&xn_auth=noI think it's AddParam. But "R…tag:www.grasshopper3d.com,2017-06-27:2985220:Comment:17751632017-06-27T11:03:46.069ZAndrew Heumannhttps://www.grasshopper3d.com/profile/AndrewHeumann
<p>I think it's AddParam. But "RegisterOutputParams" is only called once, not "every time the component outputs the result" - so it shouldn't be an issue. </p>
<p>I think it's AddParam. But "RegisterOutputParams" is only called once, not "every time the component outputs the result" - so it shouldn't be an issue. </p> Hi
it seems that is working a…tag:www.grasshopper3d.com,2017-06-27:2985220:Comment:17750932017-06-27T09:42:29.747ZPaolo Cappellettohttps://www.grasshopper3d.com/profile/PaoloCappelletto
<p>Hi</p>
<p>it seems that is working after the creation of the custom parameter.</p>
<p>Another question: When is it necessary to register the paramenter?</p>
<p></p>
<p>When I need to insert my object inside the component I use pManager.AddParameter in this way:</p>
<p>protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)<br></br> {<br></br> pManager.AddParameter(new GH_IPSketchLine(), "SketchLine", "SKL", "SketchLine", GH_ParamAccess.tree);<br></br> }</p>
<p></p>
<p>But…</p>
<p>Hi</p>
<p>it seems that is working after the creation of the custom parameter.</p>
<p>Another question: When is it necessary to register the paramenter?</p>
<p></p>
<p>When I need to insert my object inside the component I use pManager.AddParameter in this way:</p>
<p>protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)<br/> {<br/> pManager.AddParameter(new GH_IPSketchLine(), "SketchLine", "SKL", "SketchLine", GH_ParamAccess.tree);<br/> }</p>
<p></p>
<p>But I have to register the parameter every time the component output the result?</p>
<p><br/> protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)<br/> {</p>
<p>// Is this the correct way every time?????</p>
<p>pManager.RegisterParam(new GH_IPSketchLine(), "SketchLine", "SKL", "SketchLine inside the PlanarSketch", GH_ParamAccess.list);</p>
<p>// or this????</p>
<p>pManager.AddParam(new GH_IPSketchLine(), "SketchLine", "SKL", "SketchLine inside the PlanarSketch", GH_ParamAccess.list);<br/> }</p> Perfect. Thankstag:www.grasshopper3d.com,2017-06-27:2985220:Comment:17750612017-06-27T06:06:44.568ZPaolo Cappellettohttps://www.grasshopper3d.com/profile/PaoloCappelletto
<p>Perfect. Thanks</p>
<p>Perfect. Thanks</p> Hi Paolo,
Generic parameter…tag:www.grasshopper3d.com,2017-06-26:2985220:Comment:17751282017-06-26T18:44:42.813ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Hi Paolo,</p>
<p></p>
<p>Generic parameter will work, but it would be much nicer to add your own type. The SDK documentation (downloadable via the GH help menu) has example code for creating your own goo and parameter types.</p>
<p>Hi Paolo,</p>
<p></p>
<p>Generic parameter will work, but it would be much nicer to add your own type. The SDK documentation (downloadable via the GH help menu) has example code for creating your own goo and parameter types.</p> Thank you Andrew. My guts hav…tag:www.grasshopper3d.com,2017-06-26:2985220:Comment:17748212017-06-26T16:21:16.270ZPaolo Cappellettohttps://www.grasshopper3d.com/profile/PaoloCappelletto
<p>Thank you Andrew. My guts have the same feeling. This is exactly what I'm doing right now.</p>
<p>But I would like to get a more complete way to manage my data. Do you have a clear example to implement a GH_Param? It could be very helpful</p>
<p>P</p>
<p>Thank you Andrew. My guts have the same feeling. This is exactly what I'm doing right now.</p>
<p>But I would like to get a more complete way to manage my data. Do you have a clear example to implement a GH_Param? It could be very helpful</p>
<p>P</p> I *think* when you're dealing…tag:www.grasshopper3d.com,2017-06-26:2985220:Comment:17750102017-06-26T15:33:17.553ZAndrew Heumannhttps://www.grasshopper3d.com/profile/AndrewHeumann
<p>I *think* when you're dealing with custom goo types you *also* have to create your own param type as GH_Param<YourGooType> and then add that parameter, rather than relying on generic parameter. a Param_Generic returns data of type IGH_Goo; if you wanted to you could also probably harvest the data into a GH_Structure of IGH_Goo and then cast to your more specific type. I could be wrong about the above but this is what my gut says, hope it helps!</p>
<p>I *think* when you're dealing with custom goo types you *also* have to create your own param type as GH_Param<YourGooType> and then add that parameter, rather than relying on generic parameter. a Param_Generic returns data of type IGH_Goo; if you wanted to you could also probably harvest the data into a GH_Structure of IGH_Goo and then cast to your more specific type. I could be wrong about the above but this is what my gut says, hope it helps!</p>