How to query the GH file name in VB.net

Dear all,

 

The question is how to write a vb component which has one output only.

It returns the current GH ghx file name?

 

Thanks for any help.

Victor

 

Note: I tried getting the Rhino file path and file name by using 

A = RhinoDoc.ActiveDoc.Path()

 

A = RhinoDoc.ActiveDoc.Name

They both behave okay. But they wont automatically update when I load another Rhino file. I suspect I have to add a event handler or a input that update when I load a new file. Any help appreciated.

 

 

 

  • up

    David Rutten

    Hi Victor,

     

    yes, you'll need event handlers to catch events in both the Rhino document and the Grasshopper document.

     

    Since your example deals with Rhino 3dm files, I attached a file that registers these events. However I noticed we're not raising them at the best possible time, so some hackery is required. I'll talk to Steve, see if we can make this more reliable.

     

    --

    David Rutten

    david@mcneel.com

    Poprad, Slovakia

    1
    • up

      Victor Leung

      Thanks for your quick reply, David,
      I'm sorry to bother you again.

      The even handler doesn't seem to work catching the RhinoEndOpenDocument
      RhinoEndSaveDocument seems to be okay when I save to a new destination
      But open a new file is what I need most.


      I'm using Rhino 4 not 5.

       

      Thanks again

      Victor

      2