Grasshopper

algorithmic modeling for Rhino

Hi

I want to get list of used components and their relationships in a grasshopper scene by a C# component. is that possible and how?

Views: 2357

Replies to This Discussion

It is. You can iterate over all the objects in the GH_Document. That will tell you which top-level objects are present. It will not include input and output parameters of components. If you want to include those as well, then you'll need to iterate over all attributes in the GH_Document.

Relationships are a bit harder to get. You could either iterate over all the attributes, find all parameters and look at the Sources and Recipients lists. You could also use the GH_Document.CreateConnectivityDiagram method to create a data structure which contains all the forwards and backwards links that are present in a GH_Document.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

thank you...

How can get GH_Document instance of active document?

The Script component will have a GrasshopperDocument field you can use. Or you can use Component.OnPingDocument() (or owner.OnPingDocument() if you're running an older version of GH)

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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