Skip to content

Instantly share code, notes, and snippets.

@bengolder
Created October 14, 2013 13:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bengolder/6975370 to your computer and use it in GitHub Desktop.
Save bengolder/6975370 to your computer and use it in GitHub Desktop.
import clr
clr.AddReference("Grasshopper")
from Grasshopper.Kernel.Data import GH_Path
from Grasshopper import DataTree
def nestedListToDataTree(nestedlist):
dataTree = DataTree[object]()
for i, item_list in enumerate(nestedlist):
path = GH_Path(i)
dataTree.AddRange(item_list, path)
return dataTree
Copy link

ghost commented Jun 15, 2016

Great! I found your solution on Grasshopper forum and it worked perfectly for my problem.
Thank you for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment