Creating DataTree sub branches in C#

Hi everyone,

Is there a method to create the sub branches in C#?

Best,

Mahan

https://developer.rhino3d.com/api/grasshopper/html/T_Grasshopper_DataTree_1.htm
https://developer.rhino3d.com/api/grasshopper/html/T_Grasshopper_Kernel_Data_GH_Structure_1.htm
Use EnsurePath(GH_Path) or Append(T, GH_Path)/ Add(T, GH_Path) depending on which one.

1 Like

What exactly is the question?

DataTrees_Tutorial_RndPaths_15B.gh (117.5 KB)

1 Like

Thanks.

I think you use AppendElement for creating sub branches.

With regard the abstract demo cases … for a given path … path = path.AppendElement(i) adds another dimension. Prepend adds a new first dimension.

Obvioulsy - if required - you can create any sub-path imaginable suitable for your scope/case/data structure. Say:

path = new GH_Path(path.Indices[0], i, path.Indices[1], …)
path = new GH_Path(path.Indices[1], i, path.Indices[0], …)
etc etc.

See also GH_Path Members for the available possibilities.

BTW: given the opportunity - if required - you can use the GH_Lexer:

1 Like