Hello everyone,
I recently encountered the post by Nathan Miller ( New Grasshopper 2 Visual Studio Plugin Template , thanks for inspiring and publishing the template), which motivated me to try out C# coding in the new GH2 environment. I have an old code base for GH1, which I am trying to translate into GH2. While starting out, I encountered some general questions/problems:
1. I understand “Twigs” is the new class used for passing Lists from one component to another (Twig being the one recieved as an input by a component, and ITwig being the one recieved by using the Garden class to parse a List for an output). Also, I encountered a new class “Pears”, which i suppose is following the tree analogy further to represent single Items. Is there more to this, than just being wrapper classes/ can they be used interchangeably (I guess I want to understand a bit better why these were introduced in the first place).
2. The old code base (GH1) uses logic like this to read objects out of the rhino environment into the grasshopper environment:
RhinoObject[] rhObj = Rhino.RhinoDoc.ActiveDoc.Objects.FindByLayer(layer);
foreach (RhinoObject obj in rhObj) {
IGH_GeometricGoo goo = GH_Convert.ObjRefToGeometry(new ObjRef(obj.Id));
geometry.Add(goo); }
Is there a way in GH2 to achieve something similar to this?
3. My old codebase uses the
public override void CreateAttributes()
to create custom components with comboboxes, radiobuttons or sliders (learned from Custom-Grasshopper-UI-Components/CustomGhComponents at main · arup-group/Custom-Grasshopper-UI-Components · GitHub , thanks for publishing this!). How would a functionality like this be implemented in GH2?
Thanks in advance for any responses. In general, any learning resources about GH2 would be highly appreciated!
Best Regards,
Richard