GHA Developers: implementing variable parameters - Grasshopper2024-03-29T02:25:09Zhttps://www.grasshopper3d.com/forum/topics/gha-developers-implementing-variable-parameters?feed=yes&xn_auth=noThanks so much, It helped me. tag:www.grasshopper3d.com,2017-06-26:2985220:Comment:17744272017-06-26T09:42:06.278ZMahmoud AbdelRahmanhttps://www.grasshopper3d.com/profile/Mahmoud898
<p>Thanks so much, It helped me. </p>
<p>Thanks so much, It helped me. </p> Hi David.
Could you please sh…tag:www.grasshopper3d.com,2014-01-15:2985220:Comment:9903272014-01-15T16:21:27.254ZManuel Sotomayor Millanhttps://www.grasshopper3d.com/profile/ManuelSotomayorMillan
<p>Hi David.</p>
<p>Could you please share a bit of code demonstrating how to register handlers to this events in a component constructor??</p>
<p></p>
<p>I am trying to trigger some behavior when the nickname of a component changes, then I wrote this behavior on the VariableParameterMaintenance() method, but apparently it is not running when the Nickname is changed.</p>
<p></p>
<p>Thanks</p>
<p>Manuel</p>
<p>Hi David.</p>
<p>Could you please share a bit of code demonstrating how to register handlers to this events in a component constructor??</p>
<p></p>
<p>I am trying to trigger some behavior when the nickname of a component changes, then I wrote this behavior on the VariableParameterMaintenance() method, but apparently it is not running when the Nickname is changed.</p>
<p></p>
<p>Thanks</p>
<p>Manuel</p> OK. Happy to help finding bu…tag:www.grasshopper3d.com,2013-12-01:2985220:Comment:9666902013-12-01T19:03:48.514ZLuis Fraguadahttps://www.grasshopper3d.com/profile/LuisFraguada
<p>OK. Happy to help finding bugs! Thanks for the reply.</p>
<p>Luis</p>
<p>OK. Happy to help finding bugs! Thanks for the reply.</p>
<p>Luis</p> Darn, it's a bug (obviously).…tag:www.grasshopper3d.com,2013-12-01:2985220:Comment:9667552013-12-01T19:01:31.303ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Darn, it's a bug (obviously). When there are no outputs I dont even ask whether it's ok to draw a (+)... It'll be fixed in the next release, nothing you can do about it in the meantime...</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p>Darn, it's a bug (obviously). When there are no outputs I dont even ask whether it's ok to draw a (+)... It'll be fixed in the next release, nothing you can do about it in the meantime...</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p> I am updating some components…tag:www.grasshopper3d.com,2013-12-01:2985220:Comment:9665622013-12-01T17:03:33.145ZLuis Fraguadahttps://www.grasshopper3d.com/profile/LuisFraguada
<p>I am updating some components with the old Variable Parameters system with the new ZUI version. Everything is going ok, except this particular component has no output parameters and I am saying that if the side is output, no parameters should be able to be added:</p>
<blockquote><p> public bool CanInsertParameter(GH_ParameterSide side, int index)<br></br> {<br></br> if (side == GH_ParameterSide.Output)<br></br> {<br></br> return false;<br></br> …</p>
</blockquote>
<p>I am updating some components with the old Variable Parameters system with the new ZUI version. Everything is going ok, except this particular component has no output parameters and I am saying that if the side is output, no parameters should be able to be added:</p>
<blockquote><p> public bool CanInsertParameter(GH_ParameterSide side, int index)<br/> {<br/> if (side == GH_ParameterSide.Output)<br/> {<br/> return false;<br/> }<br/> if(index == 0)<br/> {<br/> return false;<br/> }<br/> return true;<br/> }</p>
<p></p>
</blockquote>
<p>Still, I get a + sign on the output:</p>
<p><a target="_self" href="http://storage.ning.com/topology/rest/1.0/file/get/2768856858?profile=original"><img width="400" class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2768856858?profile=RESIZE_480x480" width="400"/></a></p>
<p>Just a little thing, but it's messing with me!</p> Thanks, really.
I've changed…tag:www.grasshopper3d.com,2013-01-23:2985220:Comment:7751642013-01-23T12:37:40.700ZF. Eduardo Gargollohttps://www.grasshopper3d.com/profile/FEduardoGargollo
<p>Thanks, really. </p>
<p>I've changed the comments to English and corrected everything in the attached file. Now it works :)</p>
<p>It's a simple adder, that adds the variable inputs into one single output, but I hope it helps anyone who founds himself stuck as I were.</p>
<p>Thanks, really. </p>
<p>I've changed the comments to English and corrected everything in the attached file. Now it works :)</p>
<p>It's a simple adder, that adds the variable inputs into one single output, but I hope it helps anyone who founds himself stuck as I were.</p> this is your problem:
IGH_Par…tag:www.grasshopper3d.com,2013-01-23:2985220:Comment:7750822013-01-23T12:21:55.641ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>this is your problem:</p>
<blockquote><p>IGH_Param p = (IGH_Param)new Grasshopper.Kernel.Types.GH_Number(0);<br></br> p.NickName = GH_ComponentParamServer.InventUniqueNickname("abc", Params.Input); <br></br> return p;</p>
</blockquote>
<p>You need to return an instance of a class which implements <em>IGH_Param</em>. <br></br><em>GH_Number</em> is a data type, not a parameter.</p>
<blockquote><p>Param_Number param = new Param_Number();<br></br> param.Name = "Input X";<br></br> param.NickName = "X";…<br></br></p>
</blockquote>
<p>this is your problem:</p>
<blockquote><p>IGH_Param p = (IGH_Param)new Grasshopper.Kernel.Types.GH_Number(0);<br/> p.NickName = GH_ComponentParamServer.InventUniqueNickname("abc", Params.Input); <br/> return p;</p>
</blockquote>
<p>You need to return an instance of a class which implements <em>IGH_Param</em>. <br/><em>GH_Number</em> is a data type, not a parameter.</p>
<blockquote><p>Param_Number param = new Param_Number();<br/> param.Name = "Input X";<br/> param.NickName = "X";<br/> param.Description = "Do something";<br/> param.AddPersistentData(0.0);<br/> return param;</p>
</blockquote>
<p>where <em>Param_Number</em> can be found in the <em>Grasshopper.Kernel.Parameters</em> namespace.</p>
<p>--<br/>David Rutten<br/>david@mcneel.com<br/>Poprad, Slovakia</p> I think I managed to figure t…tag:www.grasshopper3d.com,2013-01-23:2985220:Comment:7751362013-01-23T11:16:49.658ZF. Eduardo Gargollohttps://www.grasshopper3d.com/profile/FEduardoGargollo
<p>I think I managed to figure that out, and the component runs, but when I press '+' in Grasshopper nothing happens.</p>
<p>I'm attaching the code of the component. When I found a solution I'll post the corrected one in order to keep it as a simple c# example of this kind of components.</p>
<p></p>
<p>Hope someone can help :)</p>
<p></p>
<p></p>
<p></p>
<p>I think I managed to figure that out, and the component runs, but when I press '+' in Grasshopper nothing happens.</p>
<p>I'm attaching the code of the component. When I found a solution I'll post the corrected one in order to keep it as a simple c# example of this kind of components.</p>
<p></p>
<p>Hope someone can help :)</p>
<p></p>
<p></p>
<p></p> After finished a standard com…tag:www.grasshopper3d.com,2013-01-23:2985220:Comment:7750262013-01-23T09:17:55.770ZF. Eduardo Gargollohttps://www.grasshopper3d.com/profile/FEduardoGargollo
<p>After finished a standard component, I'm trying to make a simple Variable Component in C#, and can't figure out what to return in method:</p>
<p>CreateParameter().</p>
<p></p>
<p>In your code (VB) you return a new Param_GenericObject() but I can't find where the IGH_Params are in C# (neither in the sdk documentation).</p>
<p>I can't also find Param_Integer(), like you said in OP.</p>
<p></p>
<p>I know I'm missing something but I don't know what.</p>
<p>After finished a standard component, I'm trying to make a simple Variable Component in C#, and can't figure out what to return in method:</p>
<p>CreateParameter().</p>
<p></p>
<p>In your code (VB) you return a new Param_GenericObject() but I can't find where the IGH_Params are in C# (neither in the sdk documentation).</p>
<p>I can't also find Param_Integer(), like you said in OP.</p>
<p></p>
<p>I know I'm missing something but I don't know what.</p> Got it. Thanks.
--
David Rut…tag:www.grasshopper3d.com,2012-12-19:2985220:Comment:7504032012-12-19T00:11:16.206ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Got it. Thanks.</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p>Poprad, Slovakia</p>
<p>Got it. Thanks.</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p>Poprad, Slovakia</p>