Programmatic FBX Export Ignores extra flags?

Hi,

I’m setting up a script to export FBX files in a certain way.
However, I am not able to replicate the behavior of manual clicks with the script.

The following python code snippet:

import Rhino
fbxPath = r"C:\Temp\TestAscii.fbx";
fbxOptions = “ExportFileAs=Version7Ascii ExportNurbsObjectsAs=Mesh YUp=Yes”;
script = ‘_-ExportWithOrigin 0,0,0 "’ + fbxPath + ‘" ’ + fbxOptions + ’ _Enter _Enter’;
Rhino.RhinoApp.RunScript(script, True);

Does not generate an FBX file in ASCII format. How come?

Hi @noamgat,

This works:

_-ExportWithOrigin 0 \users\dale\desktop\test.fbx _ExportNurbsObjectsAs=_Mesh YUp=_Yes _ExportFileAs=_Version7Ascii _Enter _Enter

You might check your string formatting and concatenation.

– Dale

What is the difference between )Mesh and Mesh (difference 1) and between Yes and _Yes (difference 2)?

The ) is a typo, that should have been _.

All the options and their values are prefixed with an underscore _.

I can confirm an issue with the FBX exporting options, arguably minor but a bit of a headache in my case. As per my finding, it turns out that the _ExportFileAs option only works if it is specified in last position. As a result, @dale’s example above works fine:

But any version of it where _ExportFileAs is not last, is bound to fail. For example

_-ExportWithOrigin 0 \users\dale\desktop\test.fbx _ExportNurbsObjectsAs=_Mesh _ExportFileAs=_Version7Ascii YUp=_Yes _Enter _Enter

does not produce an ascii file but indeed a binary one, corresponding to the default option.

Now maybe I am missing a good reason for why that would need to be, but identical tests using the stl file format (which also has an option called _ExportFileAs) do not reproduce the same behaviour.

This is definitely a bug, thanks for reporting it. I’m working on it now. You can track the progress here.

https://mcneel.myjetbrains.com/youtrack/issue/RH-67758

Tim

1 Like