Exporting to FBX from script, bug missing textures folder

When exporting from Ruby script, a scene with textures, it does not create the texture folder and the filename inside the FBX is missing the first letter. I just do:

Sketchup.active_model.export “scene.fbx”, options_hash

Inside the FBX I find : P: “Path”, “KString”, “XRefUrl”, “”, “cene/Asphalt_New.jpg” (observe the missing s letter)

SKUP Pro 2016 16.1.1449 x64
Anyone is getting this ? thanks

does the .fbx differ from a file menu export of the same skp?

or is the issue only from ruby?

.fbx export doesn’t have an options hash, it uses last used values…


Aside IDs, and the texture path issue (first letter missing in the script export), all the same, and no folder with textures generated when exporting from script. The issue is with the Ruby API call, its like they use two different code paths almost.
File->Export exports properly.
https://www.sketchup.com/intl/en/developer/docs/ourdoc/model#export says it accepts options, tho only for DAE and PDF. I’ve put anyway as in the DAE example. Also tried with true/false the last param.

Make sure your double quoted path strings are using forward slashes “/”. Back slashes “” are for escaping special characters, like a newline “\n”, a return “\r”, a tab “\t” etc.

(Moved to Ruby API sub-category.)

1 Like

John is right, you have to do a fbx export once manually and set your options. The next time you do a fbx export from ruby, it will re-use those settings. See more here:http://sketchucation.com/forums/viewtopic.php?f=180&t=61942

Check your path by using a puts to ‘print’ it from your code.Just like Dan said, it will be some faulty slash.

Ok, the options thing to be set manually for a first time is a bit silly :).
I do not have any slashes in my path, its just “scene.fbx” directly set as argument of the call, as in my initial post, which gets saved in My Documents.
This is the simplest thing ever, its just a call to export, from a simple cube scene with a standard material with texture on a few faces. If anyone could try it, its just one liner, would be grateful. Just to confirm its a bug or not.

It probably isn’t a bug - I’m using a ruby coded script to export to fbx and it works fine. Post your script and people can help.

exporter.zip (85.3 KB)

Attached the exported fbx, the script and the sample scene. Thanks. Ideally should be tested with the latest version of SKUP

Tested on two different computers, both with Win10. Same result.

this works for after ‘purging’ the extra 23 textures and adding the path to Documents…


it ‘bugsplats’ SU with the false flag…


Doesnt work for me, purged the stuff in Model Info, set the path as you showed, same results. Actually with your path string doesnt export even the fbx file at all…

these are my export settings…

after a successful export from the File menu, I get an identical ‘ruby’ export [bar the timecode and filename]…


Not working, same settings, but wait, what OS is that ? Linux/OSX? It might be a Windows bug.

I’m on a mac, but @maxB is on windows and said he reported success…

does this return a correct path?



1 Like



Also tried run as admin, same

Anyway, its clearly a bug in the C/C++ code of SU or the Ruby glue code, will try later on with Win8/7

Something is strange here.
If I copy-paste Sketchup.active_model.export "scene2.fbx", false in the ruby console it exports a scene to the documents folder but without a sub-dir with the textures.
If I change the line to Sketchup.active_model.export "d:\\tmp\\scene2.fbx", false it does create a sub-dir with the textures.

hey! thanks maxB, that’s right, might be something related to windows security… or path parsing, dont know…
but its a temp solution to save to a shorter path or another drive. Still, there is a bug.

yep, also works on C:, even with a subfolder, like c:/yolo/scene.fbx
but it fails when in Documents… what the hell…

What permissions are set for this problem ‘Documents’ folder ?
Use Properties > Security and ensure that everyone listed has ‘full control’ - read/write/modify permissions…

You can also try using:
before you then export just using the file-name, with the appropriate file-type suffix.

It should save the file to the current directory - to check what that is use