-
-
Save sbaer/1025541 to your computer and use it in GitHub Desktop.
Grasshopper File and Geometry Import 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 | |
# read geometry out of 3dm files and filter by layernames | |
if DoImport and FilePaths and LayerNames: | |
geometry = [] | |
for filepath in FilePaths: | |
model = Rhino.FileIO.File3dm.Read(filepath) | |
if not model: continue | |
for layer in LayerNames: | |
objs = model.Objects.FindByLayer(layer) | |
for obj in objs: | |
geom = obj.Geometry | |
geom.EnsurePrivateCopy() | |
geometry.append(geom) | |
# models can take up a considerable amount of | |
# memory that we don't need, so get rid of it | |
# after copying the geometry we want out of it | |
model.Dispose() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment