Add Scalar and Vector Field in Rhinocommon

Hello dear developers and Happy New Year

Working quite a lot with fields I would like that Rhinocommon embeds the Scalar and Vector Fields.

At the moment I see

  • For Grasshopper and Rhino (7 surely 6) there is Vector Field GH_FieldElement and GH_Field
  • For Isopod and Rhinoceros 8 there is Scalar Field Ifield
  • For Grasshopper 2 (rhinoceros 8) there is now Grasshopper2.Types.Fields that is Scalar and/or Vector Field

Could it be possible to have something unique (the one from GH2), I would say in Rhinocommon ? Something that could be used In Grasshopper 1 and Grasshopper 2.

1 Like

@andyopayne, @DanielPiker - feel free to chime in.

1 Like

Hi Laurent, Happy New Year

For a field which given a Point3d returns a value, one option is to use a Func<Point3d,double> (or Func<Point3d,Vector3d> etc) delegate.

One advantage of this approach is that because it is a standard part of dotnet it can be passed between components without requiring them to share any reference to one library’s specific field type (and it works in GH1 or GH2), but it can be converted to other field types within components if needed.

Here’s an example:
field_func.gh (15.3 KB)

1 Like

Hi Daniel

that is a very nice work around. So it seems worth that Grasshopper 1, Grasshopper 2 and Isopod could provide some tools to convert this type of input. I will try to add this type of input in all field input/output I use in Nautilus.