SU2POV

"A simple solution to a complex problem. Thanks for the great plugin!"
-- Mark Horner

About the mac specific changes
The Ruby language in SketchUp is cross platform, and was designed on UNIX very similar to Mac OS X, yet Ruby has been ported to windows, which pops up the odd snafu.

Changes at a glance
Mac OS X has no file called Sketchup.exe

Mac OS X uses proper unix directory separators / instead of windows directory separators \

MacOS X has AppleScript and UNIX system wide scripting

MacOS X has more secure privileges (still even with Vista)

Sketchup.exe
Mac OS X does not have a file called SketchUp.exe

so code such as this fails:

su_install_path = Sketchup.find_support_file("SketchUp.exe").split("SketchUp.exe")[0]
materials_path = su_install_path + "Materials"

The proper way to do this is:

Sketchup.find_support_file("Materials")

Unix directory separators
Mac OS X uses proper unix directory separators / instead of windows directory separators \ .

so code such as this fails:

model_filename = su_current_model.split("\\")
model_filename = model_filename[model_filename.length-1].split(".")[0]

As there are no \s in the models filename, so the array only has one element.

The proper ruby way to do this is:

model_filename = File.basename(Sketchup.active_model.path)

However, File.basename() only works on the system it is currently running on, for most paths this is OK as the paths are found by the running system. It is possible, however, for a single SketchUp model to have two textures, one of which originated on the mac, with a Mac filename and one which originated on windows with a windows filename, thus, for one of the texture filenames this would fail on either system.

One solution is to swap the / for \ before splitting so:

full_name = tex.filename.split("\\")

becomes:

full_name = tex.filename.gsub("/", "\\").split("\\")

System wide scripting
Mac OS X has unix scripting, which in turn can call AppleScript, so we can automate other applications from within SketchUp as follows:

system("osascript -e 'tell application \"MegaPOV\"' -e 'activate' -e 'end tell'")
system("osascript -e 'tell application \"System Events\"' -e 'tell process \"MegaPOV Mach-O\"' -e 'click menu item \"Start Rendering\" of menu \"Render\" of menu bar item \"Render\" of menu bar 1' -e 'end tell' -e 'end tell'")

Of course, if you want to do any heavy lifting with AppleScript, it is best to install the osx_aeosa.bundle and call AppleScript directly

Secure privileges
If you attempt to write a file in ruby without setting a path, ruby will try and write it at the top level of your hard disk. As Mac OS X is a secure system, you may not have the privileges to do this. Thus I modified SU2POV to save the report file in the same directory as the .pov file. (Which you must be able to write to otherwise you wouldn't have been able to save the .pov file)

Comparison
For those SketchUp Ruby scripters currently running Microsoft Windows and wishing to test a SketchUp on a Mac, I would recommend buying a Mac Mini. Its less than the size of 5 CD Jewel Cases.

Limitations
su2pov is limited by your own imagination.

Compatibility
su2pov should work on Mac OS 10.3 or later with the SketchUp 4.0.173 and POV-RAY 3.6 or later. I recommend MegaPOV as it makes POV-RAY easier to use.

FAQs & Support
If you're having trouble with SU2POV, please see our technical support information. If you require further assistance, please Mark Horner via email.

Line

Copyright 2005, Mark Horner.
Although care has been taken, we cannot guarantee the accuracy of information found on this website.