How to export a model in the form of .fbx with Ruby API?

ruby
export

#1

Hi everybody, I’m Piraka.

Recently, I’m using sketchup to support a project. And I hope to find a method that can help me export the model in Sketchup by ruby automatically instead of processing it by hands. While, I looked up on the net but found little bout it. So I wish someone can give me some useful idea.

Thanks!


#2

If you have the Pro version, see the “Model#export” method:


#3

There are a number of on-line converters, but it appears that they use the Open Asset Import Library. While the library features a lot of input formats, there are only four output formats:

COMMON INTERCHANGE FORMATS
Collada ( .dae )
Wavefront Object ( .obj )
Stereolithography ( .stl )
Stanford Polygon Library ( .ply )

In order to create a Ruby script to export SketchUp geometry in .fbx format, you will need to write your own exporter. This is not as difficult as it sounds, but in this case, the .fbx format is not especially well-documented. However, the ASCII format is somewhat explained here:

http://download.autodesk.com/us/fbx/2010/fbx_sdk_help/index.html?url=WS1a9193826455f5ff-150b16da11960d83164-6c6f.htm,topicNumber=d0e127

and the binary version is somewhat explained here:

You can create either format using the native Ruby file I/O.

Or, as @jim_foltz points out, you can buy Pro … poor me :slight_smile:


#4

it’s relatively easy on your mac using your Pro version of SU…

you will need to manually export the first so that SU registers all of your .fbx options…

are all the files you wish to convert in a single folder?

do they all need to be the same Template i.e. identical style?

if so. Ruby can find the folder, then for each file, import each ‘definition’ into a prepared Template and move it to origin, export to .fbx, delete it, purge unused, import next, rinse and repeat…

john