Exporting to FBX from script, bug missing textures folder

Dir.pwd is the c:/Users/nekitu/Documents/ folder
I’ve checked the properties, all allowed, no read only no Security issues…
Its not security, to me looks like some filename/path function inside SU is broken, since the filename is missing the first letter in the destination folder.

This is an excerpt from the FBX file, when “scene.fbx” is used as path:

Texture: 111225904, "Texture::Asphalt_New_texture", "" {
	Type: "TextureVideoClip"
	Version: 202
	TextureName: "Texture::Asphalt_New_texture"
	Media: "Video::Asphalt_New_texture"
	FileName: "cene/Asphalt_New.jpg"
	RelativeFilename: "..\..\..\Documents\cene\Asphalt_New.jpg"
	ModelUVTranslation: 0,0
	ModelUVScaling: 1,1
	Texture_Alpha_Source: "None"
	Cropping: 0,0,0,0

I confirm that I can replicate the error.

When done through the menu item the ‘scene’ fbx file contains the proper path and the same name folder of texture images is made.
But it’s when run from Ruby if just the file name is specified [with no folder path], then the fbx file is made in the pwd, but the folder ‘scene’ is not made and the text in the fbx file says ‘cene’ !
However, if the full path to the folder and fbx file is passed to the export method, then both the fbx file and folder with the images - both named ‘scene’- do get made, and the fbx file contains the correct path in its text - i.e. without any cropping of the name,

Report this to SketchUp directly…
Meanwhile always pass the full path to the folder…

yup. thanks guys for the time, its an official bug then :), have a nice day

if this is used, it works:

file = File.expand_path("~/Documents/scene.fbx")
Sketchup.active_model.export file

:slight_smile: thanks @john_drivenupthewall
still, the bug exists, but at least we have an workaround.

I do think that on Windows we must use the File.expand_path() call to expand the tilde into the user’s home path. Meaning, that Windows does not do it naturally, so if you pass the "~/someDir/somefile.ext" string to windows, no telling what might happen, or where the file might get written (if at all.)

Windows natively uses the %var% parameter syntax. Ie,: “%USERPROFILE%/Documents/somefile.ext

Ruby’s File.expand_path() method relies upon a HOME environment variable being set, which SketchUp has only set (on Windows) since perhaps version 2014 ? (Prior to that we had to set it ourselves. It is always set on *nix like systems.)

Dumb bug as well. Now I wonder if it also chokes when exporting other file types.