Load and Save Options

Load and Save Options — Aspose.3D FOSS for Python API Reference

Overview

All import and export operations accept an optional options object derived from LoadOptions or SaveOptions. Pass the appropriate subclass to Scene.open() or Scene.save() to control format-specific behaviour.

Package: aspose.threed.formats

from aspose.threed.formats import (
    LoadOptions, SaveOptions,
    ObjLoadOptions, ObjSaveOptions,
    GltfLoadOptions, GltfSaveOptions,
    StlLoadOptions, StlSaveOptions,
    FbxLoadOptions, FbxSaveOptions,
    ColladaLoadOptions, ColladaSaveOptions,
    ThreeMfLoadOptions, ThreeMfSaveOptions,
)

IOConfig (base)

Both LoadOptions and SaveOptions inherit from IOConfig. The following properties are available on every options object.

NameTypeDescription
file_formatFileFormat | NoneThe format this config is associated with (read-only after construction)
encodingstr | NoneText encoding hint (e.g. "utf-8")
file_systemFileSystem | NoneCustom file-system abstraction for resolving texture/MTL paths
lookup_pathslist[str]Additional directories to search when resolving external references
file_namestr | NoneBase file name used for relative-path resolution

LoadOptions

Base class for all load-option objects.

Additional property (beyond IOConfig):

NameTypeDescription
encodingstr | NoneText encoding override

SaveOptions

Base class for all save-option objects.

Additional property (beyond IOConfig):

NameTypeDescription
export_texturesboolWhen True, textures referenced by the scene are copied to the output. Defaults to False

ObjLoadOptions

Load options for Wavefront OBJ files (.obj).

from aspose.threed.formats import ObjLoadOptions
opts = ObjLoadOptions()
opts.flip_coordinate_system = True
opts.scale = 0.01
scene = Scene()
scene.open("model.obj", opts)
PropertyTypeDefaultDescription
flip_coordinate_systemboolFalseFlip the coordinate system on import
enable_materialsboolTrueLoad the accompanying .mtl material file
scalefloat1.0Uniform scale applied to all imported geometry
normalize_normalboolTrueNormalise imported normal vectors to unit length

ObjSaveOptions

Save options for Wavefront OBJ files.

from aspose.threed.formats import ObjSaveOptions
opts = ObjSaveOptions()
opts.enable_materials = False
scene.save("output.obj", opts)
PropertyTypeDefaultDescription
apply_unit_scaleboolFalseApply the scene’s unit scale factor to exported coordinates
point_cloudboolFalseExport vertices only (no polygon faces)
verboseboolFalseInclude additional OBJ comments in the output
serialize_wboolFalseWrite the W component of control points
enable_materialsboolTrueWrite a .mtl material file and reference it from the .obj
flip_coordinate_systemboolFalseFlip the coordinate system on export
axis_systemAxisSystem | NoneNoneOverride the output axis system

GltfLoadOptions

Load options for glTF 2.0 and GLB files (.gltf, .glb).

from aspose.threed.formats import GltfLoadOptions
opts = GltfLoadOptions()
opts.flip_tex_coord_v = False
scene = Scene()
scene.open("model.gltf", opts)
PropertyTypeDefaultDescription
flip_tex_coord_vboolTrueFlip V texture coordinates on import (glTF uses top-left origin; True converts to bottom-left)

GltfSaveOptions

Save options for glTF 2.0 output.

from aspose.threed.formats import GltfSaveOptions
opts = GltfSaveOptions()
opts.binary_mode = True   # produce a .glb file
scene.save("output.glb", opts)
PropertyTypeDefaultDescription
binary_modeboolFalseWhen True, writes a self-contained binary GLB; when False, writes JSON .gltf with an external buffer
flip_tex_coord_vboolTrueFlip V texture coordinates on export
export_texturesboolFalseCopy referenced textures into the output package (inherited from SaveOptions)

StlLoadOptions

Load options for STL files (.stl).

from aspose.threed.formats import StlLoadOptions
opts = StlLoadOptions()
opts.scale = 0.001   # convert millimetres to metres
scene = Scene()
scene.open("part.stl", opts)
PropertyTypeDefaultDescription
flip_coordinate_systemboolFalseFlip the coordinate system on import
scalefloat1.0Uniform scale applied to imported geometry

StlSaveOptions

Save options for STL output.

from aspose.threed.formats import StlSaveOptions
opts = StlSaveOptions()
opts.binary_mode = True
scene.save("output.stl", opts)
PropertyTypeDefaultDescription
flip_coordinate_systemboolFalseFlip the coordinate system on export
scalefloat1.0Uniform scale applied to exported geometry
binary_modeboolFalseWrite binary STL instead of ASCII STL

FbxLoadOptions

Load options for FBX files (.fbx).

from aspose.threed.formats import FbxLoadOptions
opts = FbxLoadOptions()
opts.keep_builtin_global_settings = True
scene = Scene()
scene.open("animation.fbx", opts)
PropertyTypeDefaultDescription
keep_builtin_global_settingsboolFalsePreserve FBX GlobalSettings properties in the scene asset info
compatible_modeboolFalseEnable compatibility mode for FBX files from older authoring tools

FbxSaveOptions

Save options for FBX output.

from aspose.threed.formats import FbxSaveOptions
opts = FbxSaveOptions()
opts.enable_compression = False
scene.save("output.fbx", opts)
PropertyTypeDefaultDescription
export_texturesboolFalseCopy referenced textures into the output directory
reuse_primitive_meshboolFalseDeduplicate identical mesh geometry in the output
enable_compressionboolTrueEnable binary FBX internal compression
fold_repeated_curve_dataAnyNoneFold identical animation curve segments
export_legacy_material_propertiesboolTrueInclude legacy Phong/Lambert material property nodes for compatibility
video_for_textureboolFalseEmbed texture data in FBX video nodes
embed_texturesboolFalseEmbed texture files inline in the FBX binary
generate_vertex_element_materialboolFalseAdd a VertexElementMaterial layer for per-polygon material assignment

ColladaLoadOptions

Load options for COLLADA files (.dae).

from aspose.threed.formats import ColladaLoadOptions
opts = ColladaLoadOptions()
opts.scale = 0.01
scene = Scene()
scene.open("model.dae", opts)
PropertyTypeDefaultDescription
flip_coordinate_systemboolFalseFlip the coordinate system on import
enable_materialsboolTrueImport COLLADA material definitions
scalefloat1.0Uniform scale applied to imported geometry
normalize_normalboolTrueNormalise imported normal vectors

ColladaSaveOptions

Save options for COLLADA output.

from aspose.threed.formats import ColladaSaveOptions
opts = ColladaSaveOptions()
opts.indented = False   # compact output
scene.save("output.dae", opts)
PropertyTypeDefaultDescription
flip_coordinate_systemboolFalseFlip the coordinate system on export
enable_materialsboolTrueWrite COLLADA material definitions
indentedboolTruePretty-print the XML output with indentation

ThreeMfLoadOptions / ThreeMfSaveOptions

Load and save options for 3MF files (.3mf).

from aspose.threed.formats import ThreeMfLoadOptions, ThreeMfSaveOptions

# Load
load_opts = ThreeMfLoadOptions()
scene = Scene()
scene.open("part.3mf", load_opts)

# Save
save_opts = ThreeMfSaveOptions()
scene.save("output.3mf", save_opts)

These classes inherit base properties from LoadOptions / SaveOptions respectively. No additional format-specific properties are documented for the current FOSS release.


See Also