Created
June 10, 2011 21:57
-
-
Save bengolder/1019860 to your computer and use it in GitHub Desktop.
layer_tree Grasshopper Python script
This file contains 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 Rhino | |
import scriptcontext | |
import System.Collections.Generic as SCG | |
# for accesssing GH classes | |
import clr | |
clr.AddReference("Grasshopper") | |
from Grasshopper.Kernel.Data import GH_Path | |
from Grasshopper import DataTree | |
layerTree = DataTree[SCG.IEnumerable[Rhino.Geometry.GeometryBase]]() # make a DataTree | |
for i in range(len(layernames)): | |
objs = scriptcontext.doc.Objects.FindByLayer(layernames[i]) | |
geoms = [obj.Geometry for obj in objs] | |
path = GH_Path(i) | |
layerTree.Add(geoms, path) | |
a = layerTree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment