Skip to content

Instantly share code, notes, and snippets.

@sbaer
Created October 8, 2011 16:52
Show Gist options
  • Save sbaer/1272538 to your computer and use it in GitHub Desktop.
Save sbaer/1272538 to your computer and use it in GitHub Desktop.
ghpython script for creating data trees
import rhinoscriptsyntax as rs
import Rhino
import clr
clr.AddReference("grasshopper")
import Grasshopper as gh
DomainU = rs.SurfaceDomain(srf, 0)
DomainV = rs.SurfaceDomain(srf, 1)
flatlist = []
tree = gh.DataTree[Rhino.Geometry.Point3d]()
for i in range(U):
path = gh.Kernel.Data.GH_Path(i)
for j in range(V):
ParamU = DomainU[0] + i*(DomainU[1] - DomainU[0])/(U+1)
ParamV = DomainV[0] + j*(DomainV[1] - DomainV[0])/(V+1)
point = rs.EvaluateSurface(srf, ParamU, ParamV)
flatlist.append(point)
tree.Add(point,path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment