algorithmic modeling for Rhino

Dear GHA developers. As you may have noticed the preferred gui for variable parameters has changed in 0.8.0060. The old gui is still available, but has been marked Obsolete and will soon no longer be visible in Visual Studio autocomplete.


If you have a GH_Component class that implements IGH_VarParamComponent and you wish to switch over to the new gui, please do the following:


  1. Make a duplicate of the class and give it a different ComponentId
  2. Rename the original class to xxxx_Legacy or something and change the exposure to Hidden. This will for all intents and purposes hide the old component while still allowing Grasshopper to deserialize it from files.
  3. In the duplicate class, remove the implementation of IGH_VarParamComponent and instead implement IGH_VariableParameterComponent. Never implement both in a single component!
  4. The new interface should be easier to implement (details below) than the old one and it will provide the Zooming User Interface rather than the pop-up menu interface.


Methods to implement for IGH_VariableParameterComponent:

  1. CanInsertParameter. This method is called when Grasshopper needs to know whether or not it is allowed to insert a parameter at the given location. This method is called a lot (potentially) so make it spiffy. If you return True, a ZUI insert icon will be visible at high zoom levels.
  2. CanRemoveParameter. This method is called when Grasshopper needs to know whether or not it is allowed to remove the parameter at the given location. This method is called a lot (potentially) so make it spiffy. If you return True, a ZUI delete icon will be visible at high zoom levels.
  3. CreateParameter. If a new parameter is about to be inserted, this method will be called to instantiate it. You must return a valid IGH_Param instance or insertion will abort. Typically it's enough to: return new Param_Integer();
  4. DestroyParameter. If an existing parameter is about to be destroyed this method will be called. This is your last chance to stop deletion (though ideally if you didn't want it to be deleted you should have returned false from inside CanRemoveParameter). You don't actually have to do anything in DestroyParameter() except return true, it's just there to inform you.
  5. VariableParameterMaintenance. Again, you don't have to do anything here, but it's a great spot to make sure everything is hunky-dory. If for example your parameters must adhere to a specific naming scheme, or they have to be Optional, or their access needs to be List or.... this would be the best place to put that code. VariableParameterMaintenance() will be called every time a change is made to variable parameters and also when the component is deserialized.


I'll try and write a topic for this in the SDK documentation as soon as possible but until then, feel free to ask any questions about this here.



David Rutten

Poprad, Slovakia

Views: 5927

Replies to This Discussion

this is your problem:

IGH_Param p = (IGH_Param)new Grasshopper.Kernel.Types.GH_Number(0);
p.NickName = GH_ComponentParamServer.InventUniqueNickname("abc", Params.Input);
return p;

You need to return an instance of a class which implements IGH_Param.
GH_Number is a data type, not a parameter.

Param_Number param = new Param_Number();
param.Name = "Input X";
param.NickName = "X";
param.Description = "Do something";
return param;

where Param_Number can be found in the Grasshopper.Kernel.Parameters namespace.

David Rutten
Poprad, Slovakia

Thanks, really. 

I've changed the comments to English and corrected everything in the attached file. Now it works :)

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.


Thanks so much, It helped me. 

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:

  public bool CanInsertParameter(GH_ParameterSide side, int index)
            if (side == GH_ParameterSide.Output)
                return false;
            if(index == 0)
                return false;
            return true;

Still, I get a + sign on the output:

Just a little thing, but it's messing with me!

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...


David Rutten

OK.  Happy to help finding bugs!  Thanks for the reply.







  • Add Photos
  • View All


  • Add Videos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service