Grasshopper

algorithmic modeling for Rhino

Is it possible to get the ObjectTable from an unopened Rhino file?

I assume I would set the scriptcontext.doc to a file instead of the ActiveDoc. Not sure how to do this...

Update 1: Using RhinoDoc.ReadFile(filename,FileReadOptions) replaces the currently opened file's RhinoDoc with the one from the referenced file. Interesting, but not useful.

Views: 1040

Replies to This Discussion

You'll need to use Rhino.FileIO.File3dm class to open 3dm files without loading them into Rhino. Functionality is somewhat limited this way, but you can probably harvest all the geometry you need.

Yep! Thanks, this works...

import Rhino.FileIO as io

sc.doc = ghdoc

objs = io.File3dm.Read(filename).Objects

geos = []

for obj in objs:
    geo = obj.Geometry
    geos.Add(geo)

a = geos

Thanks for the awesome script David.

also added the following line to sort geometry by layer--

geos1 = objs.FindByLayer(Layer1)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service