Import OBJ file from google drive in Grasshopper


Is there a way to get online OBJ files from google drive or similar platforms and import them in grasshopper using URL input?

Not directly, but this should work OK: Download the OBJ geometry and then use Rhino’s File/Import function to import the geometry into Rhino. Then create a Geometry object in GH and Internalize what you just imported into Rhino.

1 Like

I am currently trying a very similar thing. It should be possible in a few ways. Of course the easiest would be to use Google Drives local sync, so it just syncs a folder to your hard drive and then you can directly import the obj into Grasshopper. I believe Pancake has a node to directly import OBJ files into Grasshopper.

Google Drive doesn’t have an API, so you can’t get it directly like you can for Google Docs.

I’ll give it a go tomorrow and report back.

At work we made a c# gh node to read objs directly into grasshopper as meshes. I can’t remember what code we based it on, but after a quick Google it was probably this or this
Both have an MIT license

I imagine you could do something like this to download your file to a temp location, then read it in with one of the above libraries.
Or just point toit locally in google One.
Sorry that’s not a full solution (I’m not at a PC) but it’s some clues If you are willing to try c#

Thanks a lot for your feedback, looking forward to hearing from you.

Thanks for your help!

Sure. So I had a little play around with it. Getting a remote file is in theory possible with Python. I don’t know enough of it, but I am sure someone could make it work.

The problem with Google Drive and other cloud storages is that you don’t have a direct link to a file, but a download link. You have to deal with permissions and SSL and all that. Google Drive doesn’t have an API I think.

So its much easier to just have it sync to your computer first and then open in Grasshopper.

I have attached 2 convinient ways to open a file or a whole folder of object files in Grasshopper directly, which is way faster then using Rhino import. You will need the Pancake plugin and the Human Plugin for the file selector. Both are brilliant plugins anyways and will allow for some really cool advanced stuff. (24.6 KB)

Thanks a lot for your help seltz, this is useful!
Yeah, probably I will be using different platform than Gdrive to solve the accessibility issue.
I still need to find a way to link online files, but here’s another way to import obj files from your local disk. I used that one from local code and another component to read data (object names) from the OBJ file. (10.2 KB)

Nice, that’s also a good way.

For local code import OBJ you always need to specify a layer though, right? I couldn’t figure out how to set a wildcard and if Layer is left empty it doesn’t work.

I like the part where you get the actual names by GUID. Nice

Also check out the Plugin Wombat. It has some helpful components for dealing with files and other misceallenous stuff.

Edit: Hm, can’t get local code import to work properly. If I load a test file that I just exported from Rhino its now no longer red, but no output in LayerTree. I’ll attach the .obj file I am trying. Its all on layer Default.

test2.obj (15.9 KB)

Google Drive does have file-reading APIs while no one has implemented it in GH and it’s Python library doesn’t work with IronPython…