I should have this ready on Thursday (5/23) Sorry for the delay.
It exports the current Scene once for each In Model Style. No other options at this time.
I want to get it out, get some feedback, and debug the basic functionality before adding features.
It uses the Save dialog to select a directory as a directory browser work-around. It's a little clumsy, but it works. The image filenames are constructed using [model_name]-[scene_name]-[style_name].jpg. The export from the image below would create the 5 files shown in the 2nd image.
Download .zip archive. There are a few slight changes compared to the images.
Debugging WebDialogs
This little piece of code let's you see the source of a WebDialog, but includes any dynamically (javascript) created content. Normally, using View Source on a Dialog only shows you the original html file you defined. Very useful for WebDialog debugging.
http://billfriedrich.tripod.com/index.html?Web
http://billfriedrich.tripod.com/index.html?Web
Using Ruby Libraries from SketchUp
I found this short plugin - it's an RSS reader plugin for SketchUp. Why, you ask? I have no idea, but the author uses some interesting techniques worth noting.
This line appends the ruby library path to SketchUp Ruby's global $LOAD_PATH variable. Now, SU will look in the appended folder for required files; as demonstrated by the next 2 lines:
...
The other interesting thing the author does is use open-uri to open and read a document from the Internet into a string:
This code calls the external ruby to do the work. The -r option is equivalent to "require 'open-uri'". The -e means execute the following stuff. So, SketchUp's built-in Ruby is executing the external ruby, which prints the web page to standard out. The ` (backtick?) command in Ruby captures the output, which is then assigned to the "source" variable inside SketchUp. Clever.
Note that instead of the backticks, the author could have used:
which is synonymous with the ` ... ` syntax. I would recommend using this syntax as it will help avoid too-many-quotes syndrome.
Here's another example:
which you can probably guess what it does.
Although this technique does work, I don't think it's an optimal solution. First off, you will need to have the full Ruby installed on your computer, and there's no guarantee that your plugin's users will have it.
$LOAD_PATH << 'C:\ruby\lib\ruby\1.8'
This line appends the ruby library path to SketchUp Ruby's global $LOAD_PATH variable. Now, SU will look in the appended folder for required files; as demonstrated by the next 2 lines:
require 'rss/1.0'
require 'rss/2.0'
...
The other interesting thing the author does is use open-uri to open and read a document from the Internet into a string:
source = `ruby -r 'open-uri' -e 'puts open("#{uri}").read'`
This code calls the external ruby to do the work. The -r option is equivalent to "require 'open-uri'". The -e means execute the following stuff. So, SketchUp's built-in Ruby is executing the external ruby, which prints the web page to standard out. The ` (backtick?) command in Ruby captures the output, which is then assigned to the "source" variable inside SketchUp. Clever.
Note that instead of the backticks, the author could have used:
%x{ ... }
which is synonymous with the ` ... ` syntax. I would recommend using this syntax as it will help avoid too-many-quotes syndrome.
Here's another example:
page=%x{ruby -r 'uri' -r 'net/http' -e 'Net::HTTP.get_print URI.parse("http://www.google.com/")'}
which you can probably guess what it does.
Although this technique does work, I don't think it's an optimal solution. First off, you will need to have the full Ruby installed on your computer, and there's no guarantee that your plugin's users will have it.
SketchUp Ruby Classes Doc Sidebar for Firefox
If you use Firefox, you can specify whether or not a bookmark is to be opened in a sidebar. Simply right click on the bookmark and select Properties from the pop-up menu. Then, enable the "load this book mark in a sidebar" check box, and click OK.
To get the sketchup Ruby API class index into a sidebar, bookmark this link, then enable the sidebar option as described above.
To get the sketchup Ruby API class index into a sidebar, bookmark this link, then enable the sidebar option as described above.
Subscribe to:
Posts (Atom)
Popular Posts (Last 30 Days)
-
Sketchup materials library of 12x12 vinyl floor tiles. Download download
-
This SketchUp script assists the user in flattening, or unfolding, 3d objects onto a 2d plane. Installation Download unfoldtool.zip . M...
-
This importer lets you import both ASCII and binary STL files into SketchUp. It automatically detects the type of .stl file and imports acc...
-
The Construction Line Tool allows you to draw constructions lines in a similar way as the Pencil Tool. Toolbar: View > Toolbars >...
-
This is the first step in a greeble plugin. And by first step I mean there are possible bugs. Protrude performs 4 basic operations: div...
-
Apr 2014 * Renamed to MoveIt , and available in t SketchUcation Plugin Store Aug 16, 2009 * Released update fixing possible bugsplat...
-
As you probably know, SketchUp 8 Free does not include the ability import/export DXF/DWG files. Although there are some free and commercia...
-
Dec 18, 2010 - TIG just released a new .obj exporter. TIG's plugins are usually solid, so I recommend trying TIG's. ( TIG's OBJe...
-
This Windows-only plugin creates a Toolbar for controlling the Ruby Console It can open and close the Ruby console, clear the console, loa...
-
Update Apr 2014 - Version 1.0.1 Add a Layer to your SketchUp model and control its visibility on existing and new Scenes. Use Activa...