Relative file path in Grasshopper

Hi, I’m reading data from file in Grasshopper, but I can’t find a way to store the file path as relative path. When I sent my files to my colleagues, everything was just messed up because of the wrong file path.

Is there a way to store the file paths as relative ones? Or even convert the absolute path into relative path?

1 Like

No solution to your question, but don‘t you have a server everyone can access?

Metahopper has a component relpath Personally never used it, just throwing it out there.

Relative Path

Appends the directory this definition is saved in to a file path. Auto-converts the contents of a text panel containing an absolute path

1 Like

No, it’s not a big project but putting it into a server may be a solution.

Thanks, it works.

The component just converts relative into absolute file path. To get the relative file path automatically, I use the file path component to get the current absolute file path and then use the replace text component to cut the first current folder path string off.

1 Like


How about you set up some System or User variables, and use these variables in the path?

1 Like

Thanks, it’s a good idea. I can’t find built-in System/User Variables, but I got another solution with file path component using your idea:

  1. Get the original file path, original and new file folder paths with file path component;

  2. Use the replace text component to cut the original file folder path string off the file path, then we get the relative file path string;

  3. Use concatenate text component to combine the new file folder path and relative file path, then we have the new file path.

We don’t need add-ins with this method, and just need to choose the new folder path for once.