5
$\begingroup$

I would like to import a fbx file (3Ds Max scene file) and save the project from the command line, how can I do this?

$\endgroup$

1 Answer 1

5
$\begingroup$

You simply need one operator to import the FBX, and another operator to export the blendfile. Replace the filepath variables with the actual paths you want to use.

# Import FBX
bpy.ops.import_scene.fbx( filepath = yourFBXfilePath )

# Export blend file
bpy.ops.wm.save_mainfile( filepath = yourBlendFilePath )
$\endgroup$
5
  • $\begingroup$ I'm getting an error: "TypeError: Calling operator "bpy.ops.import_scene.fbx" error, expected a string enum in ('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS', 'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT', 'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA', 'EXEC_SCREEN')" $\endgroup$
    – Chunlin Hu
    Commented Oct 25, 2016 at 9:22
  • $\begingroup$ here is my python script $\endgroup$
    – Chunlin Hu
    Commented Oct 25, 2016 at 9:23
  • $\begingroup$ import sys import os import bpy blend_dir = os.path.dirname(bpy.data.filepath) if blend_dir not in sys.path: sys.path.append(blend_dir) # Import FBX bpy.ops.import_scene.fbx( "D:\test.fbx" ) # Export blend file bpy.ops.wm.save_mainfile( "D:\test.html" ) $\endgroup$
    – Chunlin Hu
    Commented Oct 25, 2016 at 9:23
  • 4
    $\begingroup$ Did you use the filepath keyword argument? This is the kind of error you would get if you'd just run bpy.ops.import_scene.fbx( 'MYPATH' ) instead of bpy.ops.import_scene.fbx( filepath = 'MYPATH' ). $\endgroup$
    – TLousky
    Commented Oct 25, 2016 at 9:24
  • $\begingroup$ As I thought :) Make sure to use the filepath argument for both operators. $\endgroup$
    – TLousky
    Commented Oct 25, 2016 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .