Categories: SketchUp Pro : PC :

Opening a remote url file and saving in a specific directory

Showing 1-3 of 3 messages
Opening a remote url file and saving in a specific directory RRangan 4/22/12 11:16 PM
SketchUp Version: 8 Pro, PC

Ruby question. I want to open a remote data file in Sketchup accessible through a url say http://someserver.com/data.file and save it in a specific directory on my PC. I am the owner of the remote server.
The sketchup ruby File.open does not seem to allow http://xxxx as file names.


Re: Opening a remote url file and saving in a specific directory Aerilius 4/23/12 5:56 AM
Hi,
downloading files that are not stored locally is a bit tricky. The File Open dialog on Windows and maybe also OS X only accepts local file paths (no http/ftp). Most methods in the sketchUp Ruby API as well as in Ruby itself for handling files don't download remote files automatically so you would first have to download the file programmatically before you do something with it. The standard Ruby that is used in SketchUp has also no module for downloading files. There are some Ruby extensions like Curb (cUrl for Ruby, Curl::Easy etc.) that require a full Ruby installation. If you can do a full Ruby installation and are ok with that, then you can use it; if you want to publish your plugin to any SketchUp user without fiddling with a full Ruby installation, you would have to use a SketchUp C++ extension that can be easily packaged into a plugin folder. Luckily some SketchUp Plugin developers have created a downloader:
http://forums.sketchucation.com/viewtopic.php?f=180&t=40895&p=362383
https://github.com/danawoodman/google-sketchup-file-downloader
Re: Opening a remote url file and saving in a specific directory RRangan 4/29/12 10:30 PM
Sorry for the delayed response. Thanks. Will checkout the links.