Created
April 22, 2013 08:30
-
-
Save notionparallax/5433271 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rhinoscriptsyntax as rs | |
import Rhino.Geometry as rg | |
from clr import AddReference as addr | |
addr("Grasshopper") | |
from System import Object | |
from Grasshopper import DataTree | |
from Grasshopper.Kernel.Data import GH_Path | |
def raggedListToDataTree(raggedList): | |
rl = raggedList | |
result = DataTree[object]() | |
for i in range(len(rl)): | |
temp = [] | |
for j in range(len(rl[i])): | |
temp.append(rl[i][j]) | |
#print i, " - ",temp | |
path = GH_Path(i) | |
result.AddRange(temp, path) | |
return result | |
def dataTreeToList(aTree): | |
theList = [] | |
for i in range(aTree.BranchCount ): | |
thisListPart = [] | |
thisBranch = aTree.Branch(i) | |
for j in range(len(thisBranch)): | |
thisListPart.append( thisBranch[j] ) | |
theList.append(thisListPart) | |
return theList | |
print raggedListToDataTree(dataTreeToList(somePts)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment