Best practices for using GH_*** and Rhino types in custom components


I am a bit confused about what is considered best practice for using GH_*** types vs Rhino.Geometry types when developing components. I need to be able to import data trees on the grasshopper canvas, so I am using GH_Structure to store the incoming parameter data. However, I need to use properties and methods that are only accessible through the Rhino.Geometry types. How and when should I cast the GH_* types to Rhino.* types? Should I store the data in GH_* form or should I use the Rhino.* form for class properties? Should I do this immediately after the DA.GetDataTree() call or should I leave it as GH_* data until I need to use it? Do I need to use the CastTo() and CastFrom() methods or can I just use the inline (Type) casting? I can just wing it for now, but it would be nice to know the best way to handle this to plan and organize my code. Thanks for the help!!

Everything is always stored in GH_XXXX types. If you ask for or output Rhino.Geometry types, they will be wrapped inside the appropriate goo type.

You very occasionally need the additional data fields stored on the GH_Goo types, such as the reference ID. But mostly you can get away with just using the pure types directly.

Thanks for the response, David! Should I just use DataTree for internal data structuring? is there any downside to that? Then I can avoid converting to Rhino types every time I need to manipulate geometry.