Grasshopper

algorithmic modeling for Rhino

Hi

I'm wondering if there is a way to quickly catch the current rhino file name, preferably including full path, but not necessarily. 

I have several simulations done by 3rd party programme and I'm using the same GH definition file to visualize the results, so I would like to automaticly link to the right results file.

Best Mathias

Views: 4528

Replies to This Discussion

Use this one line C# script:

A = RhinoDocument.Path;

Will give you the full path name if the file is saved

Worked like a charm. Thanks for your help, Arend!

Best, Mathias

Hi all,

I dont know if its allowed to open up this topic again, but i have a question about this.

I am not familliar with C++, but  i changed in the above code path to name, and i got the filename.

This file name is with a file extension. Is it also possible to get the file name without the file extension?

Thanks in advance.

gr Reinder

System.IO.Path.GetFileNameWithoutExtension(RhinoDocument.Path);

Thanks!

Hello! I came across this topic because i am working with multiple rhino files and i need to extract the filename each time i open them. I got this code working but the output doesn`t automatically update when i open a new file. I always need to do "Recompute".

Is there a way to constantly check the current filename?

Thanks !

simply add a timer to that component and it will execute constantly (depending on what you are doing it may slow the file if any heavy operation depends on the component you are constantly updating)

Or you could tie the component to these rhinocommon events:

http://developer.rhino3d.com/api/RhinoCommon/html/E_Rhino_RhinoDoc_...

http://developer.rhino3d.com/api/RhinoCommon/html/E_Rhino_RhinoDoc_...

And have them expire the current object, and schedule a new solution.

How would you do that? I tried it but to be honest i have no idea about C#

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service