generative modeling for Rhino
I'm trying to create a custom parameter. I've created a Data class which inherits from 'Grasshopper.Kernel.Types.IGH_Goo'. I'm not sure how to correctly implement the ScripVariable interface member:
'does not implement interface member 'Grasshopper.Kernel.Types.IGH_Goo.ScriptVariable()'.
I've tried this:
public Grasshopper.Kernel.Types.IGH_Goo ScriptVariable()
object O = this.m_MeshTopology;
Could anyone help me with this? Thanks!
public object ScriptVariable()
throw new NotImplementedException();
Now the only thing left is a warning in the Param class (GH_Param<Data_MeshTopology>) stating:
'Grasshopper.Kernel.GH_Param<Reinforcement_Toolbox.Data_MeshTopology>.GH_Param(Grasshopper.Kernel.IGH_InstanceDescription, bool)' is obsolete: 'This constructor is Obsolete and will be removed in future versions of Grasshopper.'
Should I be worried about this / is there another, better way of implementing a custom parameter?
may I ask why you chose to implement IGH_Goo from scratch instead of deriving from GH_Goo<T>?
The ScriptVariable() method is used when the data is plugged into a VB/C# script component. You may not want to give scripters access to your original data as that might give them too much power. Basically I always return a copy of the actual data wrapped in my IGH_Goo class. So GH_Brep returns a const instance of the Rhino.Geometry.Brep, GH_Integer returns a copy of the System.Int32 value and so on.
Thanks for your reply. I was actually working my way through some older code of mine, which involved creating / passing custom parameters. This seemed to work fine for me, but youre question got me wondering whether there are better ways of implementation.
I've attached the param, data and component code. If you could give me some advice, that would be great!
Since I don't have access to the RTMeshTopology class I cannot compile this code, but I made some changes. Most notably, the data class now derives from GH_Goo<T> instead of implementing IGH_Goo from scratch.
Thanks for helping me out! This looks much better.