A problem about "Goo"


it means thas i should wrap the “curve” with Igh_goo,but why should do this?can someone explain the intention of wrap?
Thank you!

All the data stored in Grasshopper data trees must implement the IGH_Goo interface. There are several reasons for this, in no particular order:

  • By wrapping structs into interfaces, it becomes possible to store them as null values.
  • The goo interface provides some methods for Grasshopper to format data so it can be shown in panels and tooltips.
  • The goo interface provides methods for Grasshopper to convert data of one type into another type, without the need to rely on a limited set of pre-defined conversion methods.
  • It also allows Grasshopper to (de)serialize data to and from files.

These are the most important reasons, but there’s more. Also other functionality (transformation, bounding-box measuring, drawing, baking) all requires that data types implement certain interfaces, so wrapping is already necessary.

GH_Structure<T> puts an IGH_Goo constraint on the the T, so you’ll have to use GH_Structure<GH_Curve> and then access the Value property of the curve goo if you want the wrapped Rhino curve. But be careful, it may be null.

thankyou,David,I understand you!i will be careful the Null.