|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|
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:
|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.