Skip to content

Instantly share code, notes, and snippets.

@bengolder bengolder/gist:1974640
Last active Aug 9, 2017

Embed
What would you like to do?
Make DataTree with Python in Grasshopper
import Rhino
import scriptcontext
# for accesssing GH classes
import clr
clr.AddReference("Grasshopper")
from Grasshopper.Kernel.Data import GH_Path
from Grasshopper import DataTree
# make a DataTree and declare the data type it contains
geometryTree = DataTree[object]()
for i in range(len(points)):
point = points[i]
# make a path for each branch you want to create
path = GH_Path(i)
# this next line adds a list (I create a list of one point)
# to the DataTree using AddRange()
geometryTree.AddRange([point], path)
# you could also use Add() to add a single item to a path
a = geometryTree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.