Python Reference Guide
 
Loading...
Searching...
No Matches
Tasks\SaveSelected.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Topic: FBApplication.FileSave
7#
8
9from pyfbsdk import *
10import os
11import tempfile
12
13# Create a cube
14lCube = FBModelCube( 'MyCubeWillNotBeSaved' )
15lCube.Show = True
16
17# Create and select a plane
18lPlane = FBModelPlane( 'MyPlaneWillBeSaved' )
19lPlane.Show = True
20lPlane.Selected = True
21
22lOptions = FBFbxOptions(False)
23
24# Save only the selected models, in ASCII format so we can have a look at the file.
25lOptions.SaveSelectedModelsOnly = True
26lOptions.UseASCIIFormat = True
27
28# Not saving system information; only focus on the selected models.
29lOptions.BaseCameras = False
30lOptions.CameraSwitcherSettings = False
31lOptions.CurrentCameraSettings = False
32lOptions.GlobalLightingSettings = False
33lOptions.TransportSettings = False
34
35# Save the selected models to file.
36lFilePath = os.path.join( tempfile.gettempdir(), "SaveSelected.fbx" )
37
38if FBApplication().FileSave(lFilePath, lOptions):
39 print("File successfully saved to %s" % lFilePath)
40else:
41 print("Failed to save file: %s" % lFilePath)
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Customize file loading and saving.
Definition: pyfbsdk_generated.h:7400
Cube model class.
Definition: pyfbsdk_generated.h:11337
Plane model class.
Definition: pyfbsdk_generated.h:11944