Grasshopper

algorithmic modeling for Rhino

Hello all

I am working in a Grasshopper project using C# and Visual Studio 2012. I would like to know how can I get my current Grasshopper document to work with it. For example, I have declared my variable:

private GH_Document GrasshopperDocument;

But GH_Document doesn't have any methods to get my active document.

Can someone help me? I'd like to do this

private GH_Document GrasshopperDocument = GH_Document.GetMyActiveDocumentSomehow;

Thank you very much

Views: 2241

Replies to This Discussion

within a GH_Component class, you can get the active document with this.OnPingDocument().

Thank you! 

Just stumbled upon this and it was exactly the information I needed. Thanks from me too :)

Just note that that method may return null under certain conditions. Be sure to check for that.

Hi David,

I am trying to expose the equivalent functionality in Visual Studio provided by the 'GrasshopperDocument' variable in the C# component. Is this the best way to go about it? Does the C# component use a different method which avoids the 'null' problem?

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