Grasshopper

algorithmic modeling for Rhino

My file is consists of several insert blocks, each of them have surfaces on a layer. I wanted to get all the objects on the layer and calculate their area. So I first get the object table of each InstanceObject using:

     block.Document.Objects

But when I try to do .FindByLayer, it failed to recognize the layer and return a null array. Then I tried to get the layerindex and using .FindByFilter and I found that the index I get using .LayerIndex is different from the one the reference document is using. (i.e. the layer index in the reference document is different) I want to know how to get the actual layer index used in that document through the FullPath of a layer.

I am using python and rhino.common.

Thanks!!!

Views: 337

Replies to This Discussion

It seems that InstanceObject.Document returns the current document instead of the inserted document. Is it possible to access the linked document's layer table? Thanks!

Instances might not contain a document, they may just be a collection of objects. I don't know enough about how Rhino deals with nested documents, you'll have to ask Rhino specific SDK questions on our discourse forum.

http://discourse.mcneel.com/

Thanks David. I got some help from that forum. For future reference, this sample file is very useful for getting all the instance references in a document.

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCs...

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service