There’s also the documentation of the DataTree
class itself:
https://developer.rhino3d.com/wip/api/grasshopper/html/T_Grasshopper_DataTree_1.htm
And some minimal examples for reading and writing two dimensional trees:
Read:
""" Read the Grasshopper Datatree "FooTree" and translates it to
a nested Python list """
pyList = [list(b) for b in FooTree.Branches]
Write:
import Grasshopper as gh
def listToTree(nestedList):
""" Convert a nested python iterable to a datatree """
dt = gh.DataTree[object]()
for i,l in enumerate(nestedList):
dt.AddRange(l,gh.Kernel.Data.GH_Path(i))
return dt
And Giulios more advanced helper functions that reads/writes arbitrary nestings: