Grasshopper

algorithmic modeling for Rhino

once again a, more or less, silly question:
i want my custom component to read the filename or ID of the document it is in. is this possible at all? because when i try to access Grasshopper.Kernel.GH_Document.DocumentID i just produce an error.
i'm sure this is due to my lack of c# skills, i'm sorry for bothering you with this.

thanks a lot,
matthias

Views: 911

Replies to This Discussion

Hi Matthias,

if you are inside a scripting component, a simple way would be:
GH_Document ghDoc = this.owner.OnPingDocument();
if(ghDoc != null)
A = ghDoc.FileNameProxy;


in a compiled component, similarly,
var ghDoc = this.OnPingDocument();
if(ghDoc != null)
string name = ghDoc.FileNameProxy;


I hope it helps,

- Giulio
____________
giulio@mcneel.com
McNeel Europe, Barcelona
thanks a lot giulio! this was exactly what i needed,
cheers
matthias

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service